libstore: move logSize into each log handler

there's no need for this to be an instance variable of the goals.

Change-Id: Iaa315e8b5d8649d8eb3c3fedc387c0f0c48945fc
This commit is contained in:
eldritch horrors
2025-10-17 11:33:00 +00:00
parent 645a0533eb
commit 711ad52776
3 changed files with 3 additions and 8 deletions
+2 -3
View File
@@ -23,6 +23,7 @@
#include <boost/outcome/try.hpp>
#include <capnp/rpc-twoparty.h>
#include <cstdint>
#include <fstream>
#include <kj/array.h>
#include <kj/async-unix.h>
@@ -1150,8 +1151,6 @@ kj::Promise<Result<SingleDrvOutputs>> DerivationGoal::registerOutputs()
Path DerivationGoal::openLogFile()
{
logSize = 0;
if (!settings.keepLog) return "";
auto baseName = std::string(baseNameOf(worker.store.printStorePath(drvPath)));
@@ -1181,7 +1180,6 @@ Path DerivationGoal::openLogFile()
return logFileName;
}
void DerivationGoal::closeLogFile()
{
auto logSink2 = std::dynamic_pointer_cast<CompressionSink>(logSink);
@@ -1205,6 +1203,7 @@ kj::Promise<Result<std::optional<Goal::WorkResult>>> DerivationGoal::handleRawCh
try {
assert(hook);
uint64_t logSize = 0;
std::string currentHookLine;
AsyncFdIoStream in(AsyncFdIoStream::shared_fd{}, hook->fromHook.get());
-5
View File
@@ -191,11 +191,6 @@ struct DerivationGoal : public Goal
AutoCloseFD fdLogFile;
std::shared_ptr<BufferedSink> logFileSink, logSink;
/**
* Number of bytes received from the builder's stdout/stderr.
*/
unsigned long logSize;
/**
* The most recent log lines.
*/
@@ -2699,6 +2699,7 @@ try {
AsyncFdIoStream in(AsyncFdIoStream::shared_fd{}, builderOutPTY.get());
LogLineSplitter splitter;
uint64_t logSize = 0;
auto flushLine = [&](const std::string & line) {
if (const auto state =