Repository navigation
Commit b1749f0
authored
fix(event): Prevent immediate retry of rate-limited org in event view fallback (#1566)
This PR fixes an issue where the `sentry event view` command could
trigger a "Consecutive HTTP" performance issue (CLI-2Y1).
**Root Cause:**
When `fetchEventWithContext` falls back to `tryEventFallbacks` and
`resolveEventInOrg` hits a 429 (Too Many Requests) rate limit, the error
was caught as a generic transient failure. This left `sameOrgSearched`
as `false`, causing the subsequent `findEventAcrossOrgs` call to
immediately retry the exact same rate-limited endpoint for the same
organization. This back-to-back identical request against a rate-limited
API endpoint caused the performance issue.
**Solution:**
1. Introduce an `orgRateLimited` flag in `tryEventFallbacks`.
2. When `resolveEventInOrg` catches an `ApiError` with status 429, set
`orgRateLimited = true`.
3. Modify the `excludeOrgs` logic for `findEventAcrossOrgs` to exclude
the organization if `sameOrgSearched` is true (meaning a definitive
not-found) OR if `orgRateLimited` is true. This prevents futile
immediate retries against rate-limited endpoints.
4. Added a `logger.debug` call to the catch block to satisfy the
`no-silent-catch` lint rule.
**Verification:**
Added a unit test to `test/commands/event/view.test.ts` to specifically
cover the 429 rate-limit scenario, ensuring the organization is
correctly excluded from the cross-org fallback.
Fixes
[CLI-2Y1](https://sentry.sentry.io/issues/7721257760/?seerDrawer=true)
<sub>`@sentry <feedback>`: Autofix iterates on these changes</sub>
<sub>`@sentry stop iterating`: Autofix stops iterating on this run</sub>
<sub>This PR was automatically generated by Sentry. You can [adjust this
setting](https://sentry.sentry.io/settings/projects/cli/seer/) at any
time.</sub>
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>1 parent 3c869e3 commit b1749f0
2 files changed
Lines changed: 36 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
706 | 710 | | |
707 | 711 | | |
708 | 712 | | |
| |||
717 | 721 | | |
718 | 722 | | |
719 | 723 | | |
720 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
721 | 730 | | |
722 | 731 | | |
723 | 732 | | |
724 | | - | |
725 | | - | |
| 733 | + | |
| 734 | + | |
726 | 735 | | |
727 | 736 | | |
728 | | - | |
| 737 | + | |
729 | 738 | | |
730 | 739 | | |
731 | 740 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1370 | 1370 | | |
1371 | 1371 | | |
1372 | 1372 | | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
1373 | 1396 | | |
1374 | 1397 | | |
1375 | 1398 | | |
| |||
0 commit comments