Sha256: 173ae5f9389a300c627e6fe851d012e19071264159c49d40d79f35694986926c
Contents?: true
Size: 584 Bytes
Versions: 14
Compression:
Stored size: 584 Bytes
Contents
require 'method_object' module Messaging module Adapters class Postgres class CreateLock include MethodObject option :key option :connection, default: -> { SerializedMessage.connection } def call connection.execute "SELECT pg_advisory_lock(#{lock_key});" rescue ActiveRecord::QueryCanceled => e Messaging.logger.debug "Locking failed, retrying in 5 seconds" sleep 5 retry end private def lock_key Zlib.crc32(key) end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems