[9.x] Add methods to append and prepend jobs to existing chain #42138
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.
This adds formal methods to append and prepend jobs to an existing chain.
The use case for that is whenever a job within a chain want's to enqueue jobs onto it's own chain without the need to create a new one and wait for successful execution of the "child chain".
This is technically already possible since all the needed properties and methods are public. However having formalized functions for that makes for a better DX.
Please let me know if this is a good idea or a too niche use case. In any way, I'm looking forward to your feedback!
Practical use case
To give a clearer use case that I came across in my own work. I have a chain that (each bullet = one job):
Here it's handy to enqueue one new job per sub folder between 4 and 5 since the hashing can take a while which might lead to timeouts. Just starting a new chain would not be a great solution since I'd need to coordinate the cleanup and exception handling all from the 4th job instead of when starting the chain initially.