Sha256: e334d12a9fa7e2e2e3921f99b769e6668b7728e62a7dd6a3b121fb6ee34b5e9d

Contents?: true

Size: 1022 Bytes

Versions: 22

Compression:

Stored size: 1022 Bytes

Contents

module GoodJob
  class PgLocks < ActiveRecord::Base
    self.table_name = 'pg_locks'.freeze

    # https://www.postgresql.org/docs/9.6/view-pg-locks.html
    # Advisory locks can be acquired on keys consisting of either a single bigint value or two integer values.
    # A bigint key is displayed with its high-order half in the classid column, its low-order half in the objid column, and objsubid equal to 1.
    # The original bigint value can be reassembled with the expression (classid::bigint << 32) | objid::bigint.
    # Integer keys are displayed with the first key in the classid column, the second key in the objid column, and objsubid equal to 2.
    # The actual meaning of the keys is up to the user. Advisory locks are local to each database, so the database column is meaningful for an advisory lock.
    def self.advisory_lock_details
      connection.select <<~SQL
        SELECT *
        FROM pg_locks
        WHERE
          locktype = 'advisory' AND
          objsubid = 1
      SQL
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
good_job-1.2.3 lib/good_job/pg_locks.rb
good_job-1.2.2 lib/good_job/pg_locks.rb
good_job-1.2.1 lib/good_job/pg_locks.rb
good_job-1.2.0 lib/good_job/pg_locks.rb
good_job-1.1.4 lib/good_job/pg_locks.rb
good_job-1.1.3 lib/good_job/pg_locks.rb
good_job-1.1.2 lib/good_job/pg_locks.rb
good_job-1.1.1 lib/good_job/pg_locks.rb
good_job-1.1.0 lib/good_job/pg_locks.rb
good_job-1.0.3 lib/good_job/pg_locks.rb
good_job-1.0.2 lib/good_job/pg_locks.rb
good_job-1.0.1 lib/good_job/pg_locks.rb
good_job-1.0.0 lib/good_job/pg_locks.rb
good_job-0.9.0 lib/good_job/pg_locks.rb
good_job-0.8.2 lib/good_job/pg_locks.rb
good_job-0.8.1 lib/good_job/pg_locks.rb
good_job-0.8.0 lib/good_job/pg_locks.rb
good_job-0.7.0 lib/good_job/pg_locks.rb
good_job-0.6.0 lib/good_job/pg_locks.rb
good_job-0.5.0 lib/good_job/pg_locks.rb