refactor: use conversation_id instead of sender_id (#7831)
This commit is contained in:
@@ -3,7 +3,7 @@ class SendOnSlackJob < MutexApplicationJob
|
|||||||
retry_on LockAcquisitionError, wait: 1.second, attempts: 6
|
retry_on LockAcquisitionError, wait: 1.second, attempts: 6
|
||||||
|
|
||||||
def perform(message, hook)
|
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
|
Integrations::Slack::SendOnSlackService.new(message: message, hook: hook).perform
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ module Redis::RedisKeys
|
|||||||
## Sempahores / Locks
|
## Sempahores / Locks
|
||||||
# We don't want to process messages from the same sender concurrently to prevent creating double conversations
|
# 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
|
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
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user