Skip to content

fix: add schedule followup#775

Merged
thomasrockhu-codecov merged 2 commits intomainfrom
th/create-followup-scheduler
Mar 18, 2026
Merged

fix: add schedule followup#775
thomasrockhu-codecov merged 2 commits intomainfrom
th/create-followup-scheduler

Conversation

@thomasrockhu-codecov
Copy link
Copy Markdown
Contributor

@thomasrockhu-codecov thomasrockhu-codecov commented Mar 17, 2026

This adds a scheduler method to re-run another task

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Note

Medium Risk
Changes upload finishing task scheduling by introducing self-rescheduling follow-ups with Redis gate TTL refresh, which could create unexpected retry/loop behavior if misconfigured.

Overview
Adds a follow-up scheduling mechanism to UploadFinisherTask so the finisher can re-queue itself as a sweep, watchdog, or immediate continuation run.

This introduces UploadFinisherFollowUpTaskType, a new FINISHER_SWEEP_DELAY, and a _schedule_followup helper that refreshes a finisher gate TTL and re-enqueues upload_finisher with an explicit trigger and type-specific countdown (including a watchdog delay based on FINISHER_GATE_TTL_SECONDS).

Written by Cursor Bugbot for commit 9fb7bd6. This will update automatically on new commits. Configure here.

@thomasrockhu-codecov thomasrockhu-codecov requested a review from a team March 17, 2026 20:02
@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.25%. Comparing base (ec58642) to head (9fb7bd6).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/worker/tasks/upload_finisher.py 72.72% 3 Missing ⚠️

❌ Your patch check has failed because the patch coverage (72.72%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #775      +/-   ##
==========================================
- Coverage   92.25%   92.25%   -0.01%     
==========================================
  Files        1305     1305              
  Lines       47957    47967      +10     
  Branches     1636     1636              
==========================================
+ Hits        44245    44252       +7     
- Misses       3401     3404       +3     
  Partials      311      311              
Flag Coverage Δ
workerintegration 58.56% <72.72%> (+<0.01%) ⬆️
workerunit 90.38% <72.72%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link
Copy Markdown

codecov-notifications bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/worker/tasks/upload_finisher.py 72.72% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Copy link
Copy Markdown
Contributor

@drazisil-codecov drazisil-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with notes

UploadFinisherFollowUpTaskType.CONTINUATION: 0,
UploadFinisherFollowUpTaskType.WATCHDOG: FINISHER_GATE_TTL_SECONDS,
}
self.app.tasks[upload_finisher_task_name].apply_async(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible race condition between when gate expired and watcher fires. Gate may be gone at that time.

Also consider a cap on time so we don't hit the issue that CODECOV-59 is fixing

--Joe

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible race condition

this should be fine, the task should check for the gate on re-run

cap on time

good call, although that perhaps defeats the purpose of the watchdog, I might just remove watchdog in the future and have continuation be 30 seconds after. and have a cron job that sweeps

@thomasrockhu-codecov thomasrockhu-codecov added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit 362d7b3 Mar 18, 2026
38 of 40 checks passed
@thomasrockhu-codecov thomasrockhu-codecov deleted the th/create-followup-scheduler branch March 18, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants