Conversation
40f18e9 to
4665c92
Compare
bgentry
approved these changes
Nov 9, 2025
Here, we add two new functions to `PeriodicJobBundle`: * `RemoveByID` * `RemoveManyByID` These are in addition to the existing `Remove` and `RemoveMany`. The new variants are useful in cases where durable jobs are in use. Tracking jobs by ID rather than handle may be more convenient, and provides a stable identifier across multiple runs. IDs were added after jobs could be added or removed dynamically, so even where durable jobs aren't in use, it may still be more convenient to remove them by ID. Unlike `Remove`, I've made `RemoveByID` return a boolean indicating whether the removal happened or not. We may want to add this to `Remove` as well given it's a useful feature, but I didn't do so for now as adding a return value could be considered a minor breaking change. Notably in the case of durable periodic jobs, removing a job by ID doesn't immediately remove it from the database. This still relies on the existing system of allowing unconfigured durable periodic jobs records to be pruned over time. We'll see if a database removal has to be a hard requirement from those requesting this feature, but not needing a database call makes things considerably simpler because (1) there's no risk of contention if a job is removed across multiple clients, and (2) no error return is necessary.
4665c92 to
f36d3e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here, we add two new functions to
PeriodicJobBundle:RemoveByIDRemoveManyByIDThese are in addition to the existing
RemoveandRemoveMany.The new variants are useful in cases where durable jobs are in use.
Tracking jobs by ID rather than handle may be more convenient, and
provides a stable identifier across multiple runs. IDs were added after
jobs could be added or removed dynamically, so even where durable jobs
aren't in use, it may still be more convenient to remove them by ID.
Unlike
Remove, I've madeRemoveByIDreturn a boolean indicatingwhether the removal happened or not. We may want to add this to
Removeas well given it's a useful feature, but I didn't do so for now as
adding a return value could be considered a minor breaking change.
Notably in the case of durable periodic jobs, removing a job by ID
doesn't immediately remove it from the database. This still relies on
the existing system of allowing unconfigured durable periodic jobs
records to be pruned over time. We'll see if a database removal has to
be a hard requirement from those requesting this feature, but not
needing a database call makes things considerably simpler because
(1) there's no risk of contention if a job is removed across multiple
clients, and (2) no error return is necessary.