RemoteStore::addToStore(): Ensure capacity is decreased on exceptions
This commit is contained in:
parent
a4c1618876
commit
3c2de9830d
|
@ -7,6 +7,7 @@
|
|||
#include "globals.hh"
|
||||
#include "derivations.hh"
|
||||
#include "pool.hh"
|
||||
#include "finally.hh"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -439,8 +440,10 @@ Path RemoteStore::addToStore(const string & name, const Path & _srcPath,
|
|||
conn->to.written = 0;
|
||||
conn->to.warn = true;
|
||||
connections->incCapacity();
|
||||
dumpPath(srcPath, conn->to, filter);
|
||||
connections->decCapacity();
|
||||
{
|
||||
Finally cleanup([&]() { connections->decCapacity(); });
|
||||
dumpPath(srcPath, conn->to, filter);
|
||||
}
|
||||
conn->to.warn = false;
|
||||
conn->processStderr();
|
||||
} catch (SysError & e) {
|
||||
|
|
Loading…
Reference in a new issue