Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): clean up event batches stuck for a long time #1770

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

detj
Copy link
Contributor

@detj detj commented Jan 23, 2025

Summary

This PR cleans up event batches that are stuck in a pending state for a long time. This prevents certain situations where ingestion can get into a 429 Too Many Requests loop and hence stall ingestion.

Note

Only stale event batches having the same id as the previous batch gets removed. So, other event batches are not affected from this change.

Tasks

  • Clean up event batches that are pending for a long time

Flow

The updated duplicate event batch check flow is as follows.

flowchart TB
	id1(Start) --> id2(Fetch request with 'msr-req-id')
	id2 --> id3{Is status pending?}
	id3 --y--> id4{Has 'created_at' passed timeout threshold?}
	id3 --n--> id5(Return '202 Accepted' known event request)
	id5 --> stop(Stop)
	id4 --y--> del(Delete pending event request)
	id4 --n--> tooMany(Return '429 Too Many Requests' response)
	tooMany --> stop
	del --> proceed(Proceed with regular ingestion flow)
	proceed --> stop
Loading

See also

- clean up event batches that are pending for a long time

fixes #1769

Signed-off-by: detj <[email protected]>
@detj detj added bug something isn't working backend backend related labels Jan 23, 2025
@detj detj self-assigned this Jan 23, 2025
Copy link

vercel bot commented Jan 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
measure-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2025 3:56pm

@detj detj requested a review from abhaysood January 23, 2025 15:58
@detj detj merged commit bc80b0a into main Jan 23, 2025
10 checks passed
@detj detj deleted the remove-stale-reqs branch January 23, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend backend related bug something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Clean up all stuck event batch(s) in pending state
2 participants