Worker: completely flush upstream buffer at startup

Completely flush the upstream buffer at startup, before attempting to
fetch a new task. These updates could impact any task on the Manager side,
and first flushing the buffer before appending new updates also seems
like a good idea.
This commit is contained in:
Sybren A. Stüvel 2022-04-21 19:01:48 +02:00
parent 90be370095
commit 55d264632f

View File

@ -94,7 +94,8 @@ func main() {
timeService := clock.New() timeService := clock.New()
buffer = upstreamBufferOrDie(client, timeService) buffer = upstreamBufferOrDie(client, timeService)
go buffer.Flush(workerCtx) // Immediately try to flush any updates. // Flush any updates before actually starting the Worker.
buffer.Flush(workerCtx)
cliRunner := worker.NewCLIRunner() cliRunner := worker.NewCLIRunner()
listener = worker.NewListener(client, buffer) listener = worker.NewListener(client, buffer)