mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	feat: set lock timeout to 1 second (#8661)
This commit is contained in:
		| @@ -1,6 +1,6 @@ | |||||||
| class SendOnSlackJob < MutexApplicationJob | class SendOnSlackJob < MutexApplicationJob | ||||||
|   queue_as :medium |   queue_as :medium | ||||||
|   retry_on LockAcquisitionError, wait: 1.second, attempts: 6 |   retry_on LockAcquisitionError, wait: 1.second, attempts: 8 | ||||||
|  |  | ||||||
|   def perform(message, hook) |   def perform(message, hook) | ||||||
|     with_lock(::Redis::Alfred::SLACK_MESSAGE_MUTEX, conversation_id: message.conversation_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 | ||||||
|   | |||||||
| @@ -12,10 +12,10 @@ | |||||||
| # end | # end | ||||||
| # | # | ||||||
| class Redis::LockManager | class Redis::LockManager | ||||||
|   # Default lock timeout set to 2 seconds. This means that if the lock isn't released |   # Default lock timeout set to 1 second. This means that if the lock isn't released | ||||||
|   # within 2 seconds, it will automatically expire. |   # within 1 second, it will automatically expire. | ||||||
|   # This helps to avoid deadlocks in case the process holding the lock crashes or fails to release it. |   # This helps to avoid deadlocks in case the process holding the lock crashes or fails to release it. | ||||||
|   LOCK_TIMEOUT = 2.seconds |   LOCK_TIMEOUT = 1.second | ||||||
|  |  | ||||||
|   # Attempts to acquire a lock for the given key. |   # Attempts to acquire a lock for the given key. | ||||||
|   # |   # | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Shivam Mishra
					Shivam Mishra