refactor: use conversation_id instead of sender_id (#7831)

This commit is contained in:
Shivam Mishra
2023-08-31 16:10:37 +07:00
committed by GitHub
parent d18d3e9e2e
commit 2acf09b3eb
2 changed files with 2 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ class SendOnSlackJob < MutexApplicationJob
retry_on LockAcquisitionError, wait: 1.second, attempts: 6
def perform(message, hook)
with_lock(::Redis::Alfred::SLACK_MESSAGE_MUTEX, sender_id: message.sender_id, reference_id: hook.reference_id) do
with_lock(::Redis::Alfred::SLACK_MESSAGE_MUTEX, conversation_id: message.conversation_id, reference_id: hook.reference_id) do
Integrations::Slack::SendOnSlackService.new(message: message, hook: hook).perform
end
end

View File

@@ -37,5 +37,5 @@ module Redis::RedisKeys
## Sempahores / Locks
# We don't want to process messages from the same sender concurrently to prevent creating double conversations
FACEBOOK_MESSAGE_MUTEX = 'FB_MESSAGE_CREATE_LOCK::%<sender_id>s::%<recipient_id>s'.freeze
SLACK_MESSAGE_MUTEX = 'SLACK_MESSAGE_LOCK::%<sender_id>s::%<reference_id>s'.freeze
SLACK_MESSAGE_MUTEX = 'SLACK_MESSAGE_LOCK::%<conversation_id>s::%<reference_id>s'.freeze
end