Retry, dependency gating, and richer AsyncResult tracking for Queueable#38
Open
Mateusz7410 wants to merge 2 commits into
Open
Retry, dependency gating, and richer AsyncResult tracking for Queueable#38Mateusz7410 wants to merge 2 commits into
Mateusz7410 wants to merge 2 commits into
Conversation
Retry & backoff: - retry(n), capped at 10 (throws above the cap instead of silently clamping) - Backoff strategies (fixed / exponential / exponential-with-jitter) as a top-level Backoff class; retryOn(...) to scope retried exceptions (every exception retried by default), with QueueableJobSetting__mdt defaults Dependency gating & chain control: - dependsOn(Async.after(result|customJobId) / afterPrevious() + succeeded()/failed()/finished()) skips a job and its dependents when a dependency's outcome doesn't match; identity is the auto-generated customJobId - imperative Async.stopChain() / Async.skipJob(customJobId), usable from a finalizer - reconcile job outcome from FinalizerContext so uncatchable failures are detected - fix rollbackOnJobExecuteFail to roll back and continue (was a no-op on its own) Observability: - one AsyncResult__c row per job (ran or skipped) with Status, ChainId, ClassName, exception detail, skip reason, retry count, and a DependsOnResult self-lookup - AsyncResultAccess permission set granting read FLS (these fields had none) Docs updated. RunLocalTests passes at 93% coverage on the non-namespaced and btcdev-namespaced scratch orgs.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🧪 Apex Test Results✅ All Tests Passed📦 Download Full Test Results & Logs 📊 Stats: 140 total | ✅ 140 passed | ❌ 0 failed |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #38 +/- ##
==========================================
+ Coverage 96.52% 96.75% +0.22%
==========================================
Files 14 15 +1
Lines 576 956 +380
==========================================
+ Hits 556 925 +369
- Misses 20 31 +11
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:
|
6 tasks
Let jobs classify failures per-exception and reset transient state before a retry, addressing cases where type-only filtering and shallow cloning fall short. - isRetryable(Exception): overridable veto evaluated where the live exception exists (catch site for handled failures, finalizer getException() for uncatchable ones). AND-composed with retryOn(types): both gates must pass. - resetForRetry(): overridable hook run on the retry clone to recreate or clear transient state (e.g. a Unit of Work) that a shallow clone would otherwise carry over. - Replace failedExceptionType/Message strings with a FailureInfo value; the retry decision is now a stored boolean, the captured metadata is audit-only. - Null-exception fallback: retry only when no retryOn filter is set; a throwing override is treated as not-retryable and recorded in RetryHistory.
74439cf to
dc764f0
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.
Summary
retry(n)(capped at 10, throws above),backoff(...)strategies via a new top-levelBackoffclass,retryOn(...), withQueueableJobSetting__mdtdefaults.dependsOn(Async.after(result|id) / afterPrevious().succeeded()/.failed()/.finished())skips a job and its dependents when a dependency's outcome doesn't match. Targets are referenced bycustomJobId.Async.stopChain()/Async.skipJob(customJobId)from a finalizer; outcome reconciled fromFinalizerContextso uncatchable failures are caught;rollbackOnJobExecuteFailfixed (was a no-op on its own — behavior change to that flag).AsyncResult__crow per job (ran or skipped) with status, chain id, class name, exception detail, skip reason, retry count, and aDependsOnResult__cself-lookup. NewAsyncResultAccesspermission set grants read FLS (these fields previously had none).queueable.md,getting-started.md).Test plan
AsyncResult__crows (status, exception, skip reason, dependency lookup, shared ChainId)prettier --checkpasses on all changed filesNotes
rollbackOnJobExecuteFailnow actually rolls back and lets the chain continue (previously a no-op unless paired withcontinueOnJobExecuteFail) — the one behavior change to a released flag.prettier:verifyreports pre-existing drift on files this branch does not touch (e.g.BatchableManager.cls); left out of scope.