Skip to content

Make worker cancellation a worker-native feature

Administrator requested to merge es/worker-cancellation into main

Created by: eseliger

When we started working on server-side execution of batch changes, we needed a feature to cancel running jobs on user-request. We back then added a mechanism that lives in the executor that fetched jobs where a cancel flag is set and used a newly added worker API Cancel(id) to cancel the job. Since this is a very generic feature and code intel would like to use it, too, it should actually live within the worker implementation. This PR does that by adding cancel to the standard set of columns and adding a job that periodically fetches jobs to cancel. It also introduces a new valid option for the state column: 'canceled'.

Closes https://github.com/sourcegraph/sourcegraph/issues/28218.

Test plan

Adjusted test suites and manually verified the cancel feature we already had still works as before.

Merge request reports

Loading