Skip to content

Feat/cooldown mechanism - #64

Merged
busehalis-sap merged 10 commits into
mainfrom
feat/cooldown-mechanism
Aug 12, 2026
Merged

Feat/cooldown mechanism#64
busehalis-sap merged 10 commits into
mainfrom
feat/cooldown-mechanism

Conversation

@busehalis-sap

Copy link
Copy Markdown
Contributor

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 window
  • ProductionHandler / LocalHandler — cooldown check applied before sending/logging each notification
  • NotificationServiceConfigurationCooldownChecker is instantiated and passed to handlers when storeNotifications is enabled
  • notificationtypes-data.cds — added ReminderNotification event for integration tests
  • CooldownCheckerTest — unit tests for cooldown logic
  • CooldownIntegrationTest — integration tests covering all cooldown scenarios
  • sample-app/notifications.cds — cooldown example on LowStockAlert
  • README.md / CHANGELOG.md — cooldown mechanism documented

@busehalis-sap
busehalis-sap requested a review from lisajulia August 5, 2026 09:56
lisajulia
lisajulia previously approved these changes Aug 11, 2026

@lisajulia lisajulia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things, other than that: very nice! Thanks! 👍

Comment thread sample-app/srv/notifications.cds Outdated
@busehalis-sap
busehalis-sap merged commit edcbd1c into main Aug 12, 2026
6 checks passed
@busehalis-sap
busehalis-sap deleted the feat/cooldown-mechanism branch August 12, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants