sourcegraph/internal/workerutil
Joe Chen 2589fef13e
lib/background: upgrade Routine interface with context and errors (#62136)
This PR is a result/followup of the improvements we've made in the [SAMS repo](https://github.com/sourcegraph/sourcegraph-accounts/pull/199) that allows call sites to pass down a context (primarily to indicate deadline, and of course, cancellation if desired) and collects the error returned from `background.Routine`s `Stop` method.

Note that I did not adopt returning error from `Stop` method because I realize in monorepo, the more common (and arguably the desired) pattern is to hang on the call of `Start` method until `Stop` is called, so it is meaningless to collect errors from `Start` methods as return values anyway, and doing that would also complicate the design and semantics more than necessary.

All usages of the the `background.Routine` and `background.CombinedRoutines` are updated, I DID NOT try to interpret the code logic and make anything better other than fixing compile and test errors.

The only file that contains the core change is the [`lib/background/background.go`](https://github.com/sourcegraph/sourcegraph/pull/62136/files#diff-65c3228388620e91f8c22d91c18faac3f985fc67d64b08612df18fa7c04fafcd).
2024-05-24 10:04:55 -04:00
..
dbworker lib/background: upgrade Routine interface with context and errors (#62136) 2024-05-24 10:04:55 -04:00
BUILD.bazel lib/background: upgrade Routine interface with context and errors (#62136) 2024-05-24 10:04:55 -04:00
CODENOTIFY codenotify: dr. fritz is kil (#57313) 2023-10-03 16:19:55 +00:00
handler.go worker: make worker constructs (handler, store, resetter etc) type parameterized (#44294) 2022-11-22 14:25:02 +00:00
idset_test.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
idset.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
main_test.go Make worker cancellation a worker-native feature (#38752) 2022-07-19 13:46:27 +02:00
mocks_test.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
observability.go Housekeeping: Rename variables to avoid collisions with packages (#47179) 2023-01-31 16:28:43 +01:00
store.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
worker_test.go lib/background: upgrade Routine interface with context and errors (#62136) 2024-05-24 10:04:55 -04:00
worker.go lib/background: upgrade Routine interface with context and errors (#62136) 2024-05-24 10:04:55 -04:00