Repository navigation
Conversation
hjlarry
requested review from
CourTeous33,
QuantumGhost and
laipz8200
as code owners
October 31, 2026 03:59
Contributor
Pyrefly Type Coverage
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## hjlarry/trigger-app-lifecycle #45190 +/- ##
=================================================================
- Coverage 88.12% 88.12% -0.01%
=================================================================
Files 5586 5587 +1
Lines 334184 334262 +78
Branches 66805 66811 +6
=================================================================
+ Hits 294491 294555 +64
- Misses 34474 34486 +12
- Partials 5219 5221 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2 of 5 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
Part of #39993. Stacked on #45188; merge that PR first.
Move the due-subscription scan and refresh-task lifecycle into an injected TriggerSubscriptionRefreshService. The repository returns detached candidates in bounded cursor-based batches and closes SQL sessions before Redis reservation or Celery publication. Cursor pagination avoids skipping later candidates when fast workers renew earlier rows during the scan.
Reserve each subscription with a UUID owner token and release reservations with compare-and-delete. New workers verify ownership before renewing. If publication fails, release failed and unsent reservations so the next scan can retry, while retaining reservations for tasks already published. Preserve the existing task names, queues, due thresholds and reservation TTL policy, and reuse the existing renewal service.
Keep task kwargs limited to tenant_id and subscription_id for rolling deployments. Carry the reservation token in Celery headers so older workers can still accept new messages; new bound tasks read the header and fall back to the legacy token "1" for older publishers. Older workers retain their existing cleanup behavior until they are replaced.
Cover due thresholds, cursor stability, session boundaries, publication failure cleanup and reservation ownership with SQL/Redis tests. The publisher test uses the real memory broker and a Celery consumer with the legacy two-argument signature; integration tests cover old and new messages reaching the new task and stale owners preserving replacement reservations.
Screenshots
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint gods