Skip to content

Commit

Permalink
Add config description
Browse files Browse the repository at this point in the history
  • Loading branch information
morgoth committed Apr 16, 2021
1 parent 5615b2f commit 5321a1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/good_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
#
# +GoodJob+ is the top-level namespace and exposes configuration attributes.
module GoodJob
# TODO: explain me
# @!attribute [rw] active_record_parent_class
# @!scope class
# The ActiveRecord parent class inherited by +GoodJob::Job+ (default: +ActiveRecord::Base+).
# Use this when using multiple databases or other custom ActiveRecord configuration.
# @return [ActiveRecord::Base]
# @example Change the base class:
# GoodJob.active_record_parent_class = "CustomApplicationRecord"
mattr_accessor :active_record_parent_class, default: "ActiveRecord::Base"

# @!attribute [rw] logger
Expand Down
4 changes: 2 additions & 2 deletions lib/good_job/lockable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def with_advisory_lock
def supports_cte_materialization_specifiers?
return @_supports_cte_materialization_specifiers if defined?(@_supports_cte_materialization_specifiers)

@_supports_cte_materialization_specifiers = Job.connection.postgresql_version >= 120000
@_supports_cte_materialization_specifiers = connection.postgresql_version >= 120000
end
end

Expand All @@ -158,7 +158,7 @@ def advisory_lock
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)]]
Job.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
Expand Down

0 comments on commit 5321a1b

Please sign in to comment.