libstore: send worker options packet as one blob

mostly to make moving this to async writes easier. this won't have a
performance impact because it's only a single packet, that's written
to a BufferedSink, but the connection sink only gets a single write.

Change-Id: I9a5f1afe7d3e25f5f4502ef9520ff2f2529431ba
This commit is contained in:
eldritch horrors
2025-06-06 18:09:46 +02:00
parent cf93814ca5
commit c13571015a
+6 -3
View File
@@ -112,7 +112,9 @@ void RemoteStore::initConnection(Connection & conn)
void RemoteStore::setOptions(Connection & conn)
{
conn.to << WorkerProto::Op::SetOptions
StringSink command;
command << WorkerProto::Op::SetOptions
<< settings.keepFailed
<< settings.keepGoing
<< settings.tryFallback
@@ -141,10 +143,11 @@ void RemoteStore::setOptions(Connection & conn)
overrides.erase(settings.pluginFiles.name);
overrides.erase(settings.storeUri.name); // the daemon *is* the store
overrides.erase(settings.tarballTtl.name); // eval-time only, implictly set by flake cli
conn.to << overrides.size();
command << overrides.size();
for (auto & i : overrides)
conn.to << i.first << i.second.value;
command << i.first << i.second.value;
StringSource{command.s}.drainInto(conn.to);
auto ex = conn.processStderr();
if (ex) std::rethrow_exception(ex);
}