Sha256: 8edaa3d13e65c554b0715b3c890dba5be457ca0e09df2f7a2cf19ad250452508
Contents?: true
Size: 660 Bytes
Versions: 34
Compression:
Stored size: 660 Bytes
Contents
require 'method_object' module Messaging module Adapters class Postgres # Creates an advisory lock that is held during the rest of the transaction. # If another session is trying to aquire the same lock it will wait until the # lock is released. # @api private class AdvisoryTransactionLock include MethodObject option :key option :connection, default: -> { SerializedMessage.connection } def call connection.execute "SELECT pg_advisory_xact_lock(#{lock_key});" end private def lock_key Zlib.crc32(key) end end end end end
Version data entries
34 entries across 34 versions & 1 rubygems