Feat/cooldown mechanism - #64
Open
busehalis-sap wants to merge 7 commits into
Open
Conversation
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.
Summary
Adds an optional cooldown mechanism to prevent sending the same notification type to the same recipient with the same target parameters too frequently.
When
cooldown: <days>is set on a@notification-annotated event, the plugin checks the notification history before sending. If a notification of the same type was already sent to the same recipient with the same target parameters within the cooldown window, the notification is skipped. If only some recipients are in cooldown, the notification is still sent to the remaining recipients.Requires
cds.notifications.storeNotifications: true.Changes
CooldownChecker— new class that queries the notification history and filters out recipients within the cooldown windowProductionHandler/LocalHandler— cooldown check applied before sending/logging each notificationNotificationServiceConfiguration—CooldownCheckeris instantiated and passed to handlers whenstoreNotificationsis enablednotificationtypes-data.cds— addedReminderNotificationevent for integration testsCooldownCheckerTest— unit tests for cooldown logicCooldownIntegrationTest— integration tests covering all cooldown scenariossample-app/notifications.cds— cooldown example onLowStockAlertREADME.md/CHANGELOG.md— cooldown mechanism documented