[go: up one dir, main page]

Skip to content

housekeeping: Use fresh context when executing job

The housekeeping middleware introduced in [1] intercepts gRPC requests and decides whether an asynchronous housekeeping job should be scheduled. The job itself is executed in a goroutine by calling the OptimizeRepository function.

The original implementation provided the active context as the first argument. This eventually causes OptimizeRepository to fail with a "context canceled" error because the active context will go out of scope and be cancelled once the current request finishes.

Instead, we need to create a fresh context with a Done channel that lives independently from the current request context.

[1] !7881 (merged)

Edited by James Liu

Merge request reports

Loading