lib/good_job/notifier.rb in good_job-1.3.0 vs lib/good_job/notifier.rb in good_job-1.3.1

- old
+ new

@@ -32,11 +32,11 @@ # Send a message via Postgres NOTIFY # @param message [#to_json] def self.notify(message) connection = ActiveRecord::Base.connection - connection.exec_query <<~SQL + connection.exec_query <<~SQL.squish NOTIFY #{CHANNEL}, #{connection.quote(message.to_json)} SQL end # List of recipients that will receive notifications. @@ -73,11 +73,11 @@ # Shut down the notifier. # This stops the background LISTENing thread. # If +wait+ is +true+, the notifier will wait for background thread to shutdown. # If +wait+ is +false+, this method will return immediately even though threads may still be running. # Use {#shutdown?} to determine whether threads have stopped. - # @param wait [Boolean] Wait for actively executing jobs to finish + # @param wait [Boolean] Wait for actively executing threads to finish # @return [void] def shutdown(wait: true) return unless @pool.running? @pool.shutdown @@ -145,9 +145,9 @@ end pg_conn = ar_conn.raw_connection pg_conn.exec("SET application_name = #{pg_conn.escape_identifier(self.class.name)}") yield pg_conn ensure - ar_conn.disconnect! + ar_conn&.disconnect! end end end