Reduces database pressure from filtered unread-count cache rebuilds during high-traffic account rollouts by serving stale snapshots longer and limiting inline saved-filter rebuild fanout. ## Closes None ## What changed - Increase filtered unread-count refresh throttling from 30 seconds to 5 minutes. - Increase the stale snapshot window from 30 minutes to 1 hour. - Reduce inline saved-filter count rebuilds per request from 10 to 3. - Update unread-count specs to assert refresh and stale behavior through the shared constants. ## How to test - Enable `conversation_unread_counts` and `unread_count_for_filters` for an account with conversation custom filters. - Open the dashboard and verify unread-count badges still return values. - Mutate conversations and verify stale filtered counts are served while rebuilds are throttled, instead of repeatedly rebuilding every 30 seconds.
11 lines
390 B
Ruby
11 lines
390 B
Ruby
module Conversations::UnreadCounts
|
|
READY_TTL = 24.hours.to_i
|
|
SET_TTL = 25.hours.to_i
|
|
FILTERED_COUNT_FRESH_TTL = 5.minutes.to_i
|
|
FILTERED_COUNT_STALE_WINDOW = 1.hour.to_i
|
|
FILTERED_COUNT_REDIS_TTL = FILTERED_COUNT_FRESH_TTL + FILTERED_COUNT_STALE_WINDOW
|
|
FILTERED_COUNT_VERSION_TTL = SET_TTL
|
|
FILTERED_COUNT_MIN_REFRESH_INTERVAL = 5.minutes.to_i
|
|
MAX_INLINE_FILTER_BUILDS = 3
|
|
end
|