From 2acf09b3eb1471d8a56ae5757aae88397a29287b Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 31 Aug 2023 16:10:37 +0700 Subject: [PATCH] refactor: use `conversation_id` instead of `sender_id` (#7831) --- app/jobs/send_on_slack_job.rb | 2 +- lib/redis/redis_keys.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/send_on_slack_job.rb b/app/jobs/send_on_slack_job.rb index 315334c3c..2503be121 100644 --- a/app/jobs/send_on_slack_job.rb +++ b/app/jobs/send_on_slack_job.rb @@ -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 diff --git a/lib/redis/redis_keys.rb b/lib/redis/redis_keys.rb index 65f966037..dc0b672ef 100644 --- a/lib/redis/redis_keys.rb +++ b/lib/redis/redis_keys.rb @@ -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::%s::%s'.freeze - SLACK_MESSAGE_MUTEX = 'SLACK_MESSAGE_LOCK::%s::%s'.freeze + SLACK_MESSAGE_MUTEX = 'SLACK_MESSAGE_LOCK::%s::%s'.freeze end