🐛 Fix stale SMTP quota cache on user/alias update and global settings change#1261
Merged
0x46616c6b merged 1 commit intomainfrom Apr 21, 2026
Merged
🐛 Fix stale SMTP quota cache on user/alias update and global settings change#12610x46616c6b merged 1 commit intomainfrom
0x46616c6b merged 1 commit intomainfrom
Conversation
… change Cache entries for SMTP quotas were not invalidated when: 1. An existing user's or alias's smtpQuotaLimits were updated (only postPersist was listened to, not postUpdate) 2. Global smtp_quota_limit_per_hour/per_day settings were changed (fallback values were baked into the cached result) Move the global settings fallback outside the cache callback so it is evaluated on every request, and add postUpdate listeners to both entity cache invalidation listeners. Co-Authored-By: OpenCode <noreply@opencode.ai>
|
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
The Postfix API endpoint
/api/postfix/smtp_quota/{email}could return stale SMTP quota limits for up to 24 hours (cache TTL) in three scenarios:InvalidateUserCacheListeneronly listened onpostPersist, so updating an existing user'ssmtpQuotaLimitsdid not invalidate the cache.InvalidateAliasCacheListener.smtp_quota_limit_per_hour/smtp_quota_limit_per_day) were resolved inside the cache callback and baked into the cached result. Changing these settings had no effect until cache expiry.Fix
postUpdateevent listener alongside the existingpostPersist.The changes and the PR were generated by OpenCode.