mirror of
https://github.com/discourse/discourse.git
synced 2024-12-22 16:35:58 +08:00
24ec06ff85
This was reverted in 38cebd3ed5
.
The issue was that I was using Discourse.redis.delete_prefixed
which does a slow redis KEYS lookup, which is not advised in
production. This commit removes that, and also ensures the periodical
thread count update only happens if threading is enabled.
I changed to use a redis INCR/DECR for reply count
cache. This avoids a round trip to redis to GET the current
count, and also avoids multi-process issues, where
if there's two processes trying to increment at the
same time, they may both receive the same value, add one
to it, then both write the same value back.
Then, it's only n+1 instead of n+2.
This also prevents almost all chat scheduled jobs from
running if chat is disabled, the only one remaining is
the message retention job.
16 lines
283 B
Ruby
16 lines
283 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
module Chat
|
|
class EmailNotifications < ::Jobs::Scheduled
|
|
every 5.minutes
|
|
|
|
def execute(args = {})
|
|
return if !SiteSetting.chat_enabled
|
|
|
|
::Chat::Mailer.send_unread_mentions_summary
|
|
end
|
|
end
|
|
end
|
|
end
|