Fix cross-project bot throttling and event cleanup - #2593
Open
landong-coder wants to merge 3 commits into
Open
landong-coder wants to merge 3 commits into
landong-coder wants to merge 3 commits into
Conversation
niemyjski
reviewed
Sep 22, 2026
niemyjski
left a comment
Member
There was a problem hiding this comment.
Thanks a ton for your pr, these changes would really help a lot and we really appreciate it. I left a few comments which I feel would really help testing and debugging this in production scenarios.
landong-coder
force-pushed
the
issue/project-scoped-bot-throttling
branch
from
September 22, 2026 02:25
6f0dc6c to
c908242
Compare
ejsmith
reviewed
Sep 24, 2026
landong-coder
force-pushed
the
issue/project-scoped-bot-throttling
branch
from
September 24, 2026 02:22
c908242 to
3f173c0
Compare
This branch has not been deployed
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.
Bot throttling currently shares an IP/time-window counter across projects and organizations. Its cleanup job also deletes matching events across the entire organization, so one project's traffic can throttle another project or remove events from a project with bot filtering disabled.
Scope counters and batch grouping by organization, project, and client IP. Cache keys use
Organization:{organizationId}:Project:{projectId}:bot:{period}:{ip}through a dedicated helper. Cleanup callsRemoveAllByProjectAndClientIpAsync; organization-wide retention cleanup callsRemoveAllByOrganizationAndClientIpAsync. Interface declarations, implementations, callers, and tests use these explicit scope names. Invalid cleanup tasks fail before deletion.Tests and validation
7e1c4e9ad.TestWithLoggingBase, its logger factory, and asynchronous disposal.git diff --checkpassed.Compatibility and deployment
Repository interface breaking change: the organization-scoped
RemoveAllAsyncoverload is renamed toRemoveAllByOrganizationAndClientIpAsync, as requested in review. External source callers or customIEventRepositoryimplementations using that overload must update and rebuild. The project-scoped method introduced in this PR is namedRemoveAllByProjectAndClientIpAsync. Existing generic repository deletion APIs remain unchanged. No HTTP API, configuration-key, or work-item payload changes.The new cache keys start fresh per-project counters; old shared keys expire naturally. Update all event-processing and cleanup worker instances together. Existing queued tasks with valid project IDs remain supported; invalid tasks fail before deletion.