Add Async.queueable() no-arg builder for conditional chaining#32
Merged
Conversation
Lets callers compose a queueable chain when the set of jobs depends on runtime conditions, without needing a sentinel first job. Calling enqueue() on a builder with zero jobs is a safe no-op that returns an Async.Result with an empty queueableChainState.jobs list. Closes #28
Adds the previously undocumented Result.job field to the Result properties table, and rewords the salesforceJobId description to match the post-fix behavior (the first-chain job id is now reported, not the last builder-supplied one). Also notes the null states when enqueue() is called on an empty Async.queueable() builder.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🧪 Apex Test Results✅ All Tests Passed📦 Download Full Test Results & Logs 📊 Stats: 89 total | ✅ 89 passed | ❌ 0 failed |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #32 +/- ##
==========================================
+ Coverage 96.47% 96.52% +0.04%
==========================================
Files 14 14
Lines 568 576 +8
==========================================
+ Hits 548 556 +8
Misses 20 20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
20 tasks
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.
Summary
Async.queueable()no-arg overload + matchingQueueableBuilder()constructor so jobs can be chained incrementallychain(QueueableJob)skips the implicitchain()step when the builder has no current job, so the first.chain(job)on an empty builder becomes the first job in the chainenqueue()on an empty builder returns aResultwithnullsalesforceJobIdand an emptyQueueableChainState(no-op, no exception)Result.joband clarify thesalesforceJobIddescription inwebsite/api/queueable.mdAsyncTestmethods: empty enqueue, single chain on empty builder, multi-chain via repeated.chain(), and conditional-branch chainingWhy
Closes #28. Lets callers build a chain whose membership depends on runtime conditions without workarounds:
Test plan
bash scripts/agent/verify.sh full(CI-parity local Apex tests + coverage)bash scripts/agent/verify.sh ns(btcdev-namespaced scratch — package-install perspective)Files
force-app/main/default/classes/Async.cls(+4)force-app/main/default/classes/queue/QueueableBuilder.cls(+11, -2)force-app/main/default/classes/AsyncTest.cls(+90, -1)website/api/queueable.md(+73, -35)Closes #28