fix(push): cap push notification configs per task - #405
Open
ez-lbz wants to merge 2 commits into
Open
Conversation
Save allowed an unlimited number of push configs per task, letting a client grow the store without bound. Enforce maxPushConfigsPerTask (50) per task: new insertions beyond the limit return an ErrInvalidParams error while updating an existing config at the limit stays allowed. Update the concurrent-creation test to stay within the limit and add a regression test for the cap. Behavior change: creating a 51st push config for a task now fails with an invalid-params error.
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.
What changed
1. Cap push notification configs per task
Problem:
InMemoryPushConfigStore.Saveaccepted an unlimited number of push configs per task, letting a client grow the store without bound.Fix (a2asrv/push/store.go, a2asrv/push/store_test.go):
maxPushConfigsPerTask = 50; new insertions beyond the limit are rejected witha2a.ErrInvalidParams(task %s already has the maximum number of push notification configs (50)).TestInMemoryPushConfigStore_MaxConfigsPerTaskand reduced the concurrency test to 50 goroutines so every concurrent save still succeeds.Testing
go test ./a2asrv/push/ ./a2asrv/... ./a2agrpc/...— all pass.TestInMemoryPushConfigStore_MaxConfigsPerTaskcovers rejection beyond the limit, update-at-limit, and count stability.Behavior change: the 51st distinct push config for a task is rejected with an invalid-params error.