Close archive writers when the delivery engine stops (closes #280) #332

Merged
clawbot merged 2 commits from issue-280-close-archives-at-stop into next 2026-09-29 08:30:24 +02:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit d03bb0ed08 - Show all commits
+3 -3
View File
@@ -368,9 +368,9 @@ func (e *Engine) start() {
// writer for long by then: the archive sweeper stops before the // writer for long by then: the archive sweeper stops before the
// engine, and deleting a webhook only closes one. If the pool did // engine, and deleting a webhook only closes one. If the pool did
// not drain in time, the writers are left open, as a kill would // not drain in time, the writers are left open, as a kill would
// leave them: a worker still running may be mid-write, and // leave them. Closing them would wait for any write in progress,
// closing its writer would wait on that write and then fail the // and a worker still running would then open new writers that
// next delivery the worker archives. // nothing closes, so it gains nothing over a kill.
func (e *Engine) stop(ctx context.Context) error { func (e *Engine) stop(ctx context.Context) error {
e.log.Info("delivery engine stopping") e.log.Info("delivery engine stopping")
+4 -4
View File
@@ -327,10 +327,10 @@ func TestEngine_StopHookClosesArchives(t *testing.T) {
} }
// TestEngine_StopHookTimeoutLeavesArchivesOpen covers a stop whose // TestEngine_StopHookTimeoutLeavesArchivesOpen covers a stop whose
// budget runs out while a worker is still running. That worker may // budget runs out while a worker is still running. The archive
// be in the middle of an archive write, so the archive writers are // writers are left open, as a kill would leave them: closing them
// left open, as a kill would leave them, rather than closed // would wait for any write in progress, and that worker would then
// underneath it. // open new writers that nothing closes.
func TestEngine_StopHookTimeoutLeavesArchivesOpen(t *testing.T) { func TestEngine_StopHookTimeoutLeavesArchivesOpen(t *testing.T) {
t.Parallel() t.Parallel()