feat(sync): add delayed task submission for throttling#1506
Draft
feat(sync): add delayed task submission for throttling#1506
Conversation
|
Collaborator
Author
|
@sentry review |
Collaborator
Author
|
@cursor review |
Add sentry__bgworker_submit_delayed() to defer task execution by a given number of milliseconds. Tasks are sorted by readiness time using monotonic timestamps, so a ready delayed task is not bypassed by a later-submitted immediate task. On shutdown, tasks that exceed the deadline (started + timeout) are pruned while the rest execute normally. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The flush marker now uses the last task's deadline (capped at the flush timeout) so it sorts after all current tasks including delayed ones. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract the core submission logic into submit_at which takes an absolute execute_after time. submit and submit_delayed become thin wrappers. Use submit_at in bgworker_delayed_tasks to pin all tasks to a single base timestamp, making the test ordering deterministic regardless of OS preemption between submissions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0f6f4b9 to
a4428e0
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.
WIP: Early draft for AI review & CI feedback...
Add
sentry__bgworker_submit_delayed()to allow deferring task execution by a given number of milliseconds. This paves the road for HTTP retries that should be throttled on startup (similar to Cocoa/iOS and Java/Android SDKs that throttle HTTP retries by 100ms).#skip-changelog (internal)