Skip to content

Remove scheduler rows for deleted projects - #13558

Merged
HarshMN2345 merged 3 commits into
mainfrom
codex/sentry-schedule-orphans
Sep 9, 2026
Merged

HarshMN2345 merged 3 commits into
mainfrom
codex/sentry-schedule-orphans

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Fixes CLOUD-3QVV.

A scheduled function whose project has been deleted is rediscovered on every full reconciliation. The source reports the missing project but leaves the schedule row in place, producing repeated errors indefinitely.

Remove that orphan synchronously before reporting the missing project. Database read failures preserve the row, and deletion failures propagate so the next reconciliation can retry. Do not cache missing projects, so a project that becomes available can serve subsequent schedules. Schedules belonging to live projects are preserved.

Validation:

  • Three regression cases failed before the fix; all 4 source/scheduler unit tests now pass (11 assertions), including failed reads, failed deletions, recovery and preservation of a live sibling schedule.
  • Tests pass using the normal PHP 8.5 container bootstrap as well as the isolated library bootstrap.
  • Focused PHPStan, Pint and git diff --check pass.

This covers source reconciliation behavior. It does not change project-deletion workers or maintenance policy.

The regression test is in tests/unit/Schedule/Source/DatabaseTest.php, mirroring the source library. There is no existing unit test class for this library; the existing FunctionsSchedule and Projects/Schedules suites cover HTTP APIs.

@greptile-apps

greptile-apps Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

The scheduler cleanup change appears safe to merge, with no outstanding correctness or repository-rule issues.

Summary

  • Missing-project results are no longer cached, allowing later schedules to recover if the project becomes visible.
  • Regression tests cover orphan removal, live sibling preservation, failed project reads, failed deletions, and recovery.

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → codex/sentry-schedule-orphans (after).

Metric Before After Change
🚀 Requests/sec 254.29 259.1 ⚪ +1.9%
⏱️ Latency P50 69.29 ms 67.5 ms ⚪ -2.6%
⏱️ Latency P95 158.46 ms 154.37 ms ⚪ -2.6%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 67.5 154.37 16,017 259.1 -4.1
Account 128.71 235.23 843 14.07 -6.31
TablesDB 65.37 117.88 8,711 142.64 -5.9
Storage 61.68 136.15 4,215 71.31 -3.57
Functions 100.25 189.57 2,248 38.69 -2.23

Top API waits (after)

API request Max wait (ms)
account.name.update 469.05
account.prefs.update 323.55
functions.variables.update 310.16
functions.delete 271.45
functions.create 267.84

@HarshMN2345
HarshMN2345 merged commit e7e1f17 into main Sep 9, 2026
7 checks passed
@ChiragAgg5k ChiragAgg5k mentioned this pull request Sep 10, 2026
2 of 4 tasks
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