forked from lix-project/lix
Remove warnLargeDump()
This message was unhelpful (#1184) and probably misleading since memory is O(1) in most cases now.
This commit is contained in:
parent
c3769c6846
commit
53e7b7e8ac
|
@ -580,7 +580,6 @@ ref<const ValidPathInfo> RemoteStore::addCAToStore(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
conn->to.written = 0;
|
conn->to.written = 0;
|
||||||
conn->to.warn = true;
|
|
||||||
connections->incCapacity();
|
connections->incCapacity();
|
||||||
{
|
{
|
||||||
Finally cleanup([&]() { connections->decCapacity(); });
|
Finally cleanup([&]() { connections->decCapacity(); });
|
||||||
|
@ -591,7 +590,6 @@ ref<const ValidPathInfo> RemoteStore::addCAToStore(
|
||||||
dumpString(contents, conn->to);
|
dumpString(contents, conn->to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conn->to.warn = false;
|
|
||||||
conn.processStderr();
|
conn.processStderr();
|
||||||
} catch (SysError & e) {
|
} catch (SysError & e) {
|
||||||
/* Daemon closed while we were sending the path. Probably OOM
|
/* Daemon closed while we were sending the path. Probably OOM
|
||||||
|
|
|
@ -48,24 +48,9 @@ FdSink::~FdSink()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t threshold = 256 * 1024 * 1024;
|
|
||||||
|
|
||||||
static void warnLargeDump()
|
|
||||||
{
|
|
||||||
warn("dumping very large path (> 256 MiB); this may run out of memory");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FdSink::write(std::string_view data)
|
void FdSink::write(std::string_view data)
|
||||||
{
|
{
|
||||||
written += data.size();
|
written += data.size();
|
||||||
static bool warned = false;
|
|
||||||
if (warn && !warned) {
|
|
||||||
if (written > threshold) {
|
|
||||||
warnLargeDump();
|
|
||||||
warned = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
writeFull(fd, data);
|
writeFull(fd, data);
|
||||||
} catch (SysError & e) {
|
} catch (SysError & e) {
|
||||||
|
@ -448,11 +433,6 @@ Error readError(Source & source)
|
||||||
|
|
||||||
void StringSink::operator () (std::string_view data)
|
void StringSink::operator () (std::string_view data)
|
||||||
{
|
{
|
||||||
static bool warned = false;
|
|
||||||
if (!warned && s.size() > threshold) {
|
|
||||||
warnLargeDump();
|
|
||||||
warned = true;
|
|
||||||
}
|
|
||||||
s.append(data);
|
s.append(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,19 +97,17 @@ protected:
|
||||||
struct FdSink : BufferedSink
|
struct FdSink : BufferedSink
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
bool warn = false;
|
|
||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
|
|
||||||
FdSink() : fd(-1) { }
|
FdSink() : fd(-1) { }
|
||||||
FdSink(int fd) : fd(fd) { }
|
FdSink(int fd) : fd(fd) { }
|
||||||
FdSink(FdSink&&) = default;
|
FdSink(FdSink&&) = default;
|
||||||
|
|
||||||
FdSink& operator=(FdSink && s)
|
FdSink & operator=(FdSink && s)
|
||||||
{
|
{
|
||||||
flush();
|
flush();
|
||||||
fd = s.fd;
|
fd = s.fd;
|
||||||
s.fd = -1;
|
s.fd = -1;
|
||||||
warn = s.warn;
|
|
||||||
written = s.written;
|
written = s.written;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue