lib/good_job/lockable.rb in good_job-1.9.0 vs lib/good_job/lockable.rb in good_job-1.9.1
- old
+ new
@@ -141,11 +141,11 @@
end
def supports_cte_materialization_specifiers?
return @_supports_cte_materialization_specifiers if defined?(@_supports_cte_materialization_specifiers)
- @_supports_cte_materialization_specifiers = ActiveRecord::Base.connection.postgresql_version >= 120000
+ @_supports_cte_materialization_specifiers = connection.postgresql_version >= 120000
end
end
# Acquires an advisory lock on this record if it is not already locked by
# another database session. Be careful to ensure you release the lock when
@@ -156,10 +156,10 @@
query = <<~SQL.squish
SELECT 1 AS one
WHERE pg_try_advisory_lock(('x'||substr(md5($1 || $2::text), 1, 16))::bit(64)::bigint)
SQL
binds = [[nil, self.class.table_name], [nil, send(self.class.primary_key)]]
- ActiveRecord::Base.connection.exec_query(pg_or_jdbc_query(query), 'GoodJob::Lockable Advisory Lock', binds).any?
+ self.class.connection.exec_query(pg_or_jdbc_query(query), 'GoodJob::Lockable Advisory Lock', binds).any?
end
# Releases an advisory lock on this record if it is locked by this database
# session. Note that advisory locks stack, so you must call
# {#advisory_unlock} and {#advisory_lock} the same number of times.