Skip to content

Commit

Permalink
refactor: use conversation_id instead of sender_id (#7831)
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmishra committed Aug 31, 2023
1 parent d18d3e9 commit 2acf09b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/jobs/send_on_slack_job.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/redis/redis_keys.rb
Expand Up @@ -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

0 comments on commit 2acf09b

Please sign in to comment.