lib/good_job/notifier.rb in good_job-3.99.1 vs lib/good_job/notifier.rb in good_job-4.0.0
- old
+ new
@@ -49,11 +49,11 @@
thread_cattr_accessor :connection
# Send a message via Postgres NOTIFY
# @param message [#to_json]
def self.notify(message)
- connection = ::GoodJob::Execution.connection
+ connection = ::GoodJob::Job.connection
connection.exec_query <<~SQL.squish
NOTIFY #{CHANNEL}, #{connection.quote(message.to_json)}
SQL
end
@@ -249,11 +249,11 @@
@task
end
def with_connection
Rails.application.executor.wrap do
- self.connection = ::GoodJob::Execution.connection_pool.checkout.tap do |conn|
- ::GoodJob::Execution.connection_pool.remove(conn)
+ self.connection = ::GoodJob::Job.connection_pool.checkout.tap do |conn|
+ ::GoodJob::Job.connection_pool.remove(conn)
end
end
connection.execute("SET application_name = #{connection.quote(self.class.name)}")
yield