Skip to content

Commit cb04808

Browse files
committed
A bit of reformatting
1 parent 23f33f4 commit cb04808

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

lib/gouda.rb

+6-8
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ def self.configure
6464
def self.logger
6565
# By default, return a logger that sends data nowhere. The `Rails.logger` method
6666
# only becomes available later in the Rails lifecycle.
67-
@fallback_gouda_logger ||= begin
68-
ActiveSupport::Logger.new($stdout).tap do |logger|
69-
logger.level = Logger::WARN
70-
end
67+
@fallback_gouda_logger ||= ActiveSupport::Logger.new($stdout).tap do |logger|
68+
logger.level = Logger::WARN
7169
end
7270

7371
# We want the Rails-configured loggers to take precedence over ours, since Gouda
@@ -81,22 +79,22 @@ def self.logger
8179
Rails.try(:logger) || ActiveJob::Base.try(:logger) || @fallback_gouda_logger
8280
end
8381

84-
def self.suppressing_sql_logs(&blk)
82+
def self.suppressing_sql_logs(&)
8583
# This is used for frequently-called methods that poll the DB. If logging is done at a low level (DEBUG)
8684
# those methods print a lot of SQL into the logs, on every poll. While that is useful if
8785
# you collect SQL queries from the logs, in most cases - especially if this is used
8886
# in a side-thread inside Puma - the output might be quite annoying. So silence the
8987
# logger when we poll, but just to INFO. Omitting DEBUG-level messages gets rid of the SQL.
9088
if Gouda::Workload.logger
91-
Gouda::Workload.logger.silence(Logger::INFO, &blk)
89+
Gouda::Workload.logger.silence(Logger::INFO, &)
9290
else
9391
# In tests (and at earlier stages of the Rails boot cycle) the global ActiveRecord logger may be nil
9492
yield
9593
end
9694
end
9795

98-
def self.instrument(channel, options, &block)
99-
ActiveSupport::Notifications.instrument("#{channel}.gouda", options, &block)
96+
def self.instrument(channel, options, &)
97+
ActiveSupport::Notifications.instrument("#{channel}.gouda", options, &)
10098
end
10199

102100
def self.create_tables(active_record_schema)

lib/gouda/adapter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def enqueue_all(active_jobs)
5757
# We can't tell Postgres to ignore conflicts on _both_ the scheduler key and the enqueue concurrency key but not on
5858
# the ID - it is either "all indexes" or "just one", but never "this index and that index". MERGE https://www.postgresql.org/docs/current/sql-merge.html
5959
# is in theory capable of solving this but let's not complicate things all to hastily, the hour is getting late
60-
scheduler_key = active_job.try(:executions) == 0 ? active_job.scheduler_key : nil # only enforce scheduler key on first workload
60+
scheduler_key = (active_job.try(:executions) == 0) ? active_job.scheduler_key : nil # only enforce scheduler key on first workload
6161
{
6262
active_job_id: active_job.job_id, # Multiple jobs can have the same ID due to retries, job-iteration etc.
6363
scheduled_at: active_job.scheduled_at || t_now,

lib/gouda/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Gouda
4-
VERSION = "0.1.12"
4+
VERSION = "0.1.13"
55
end

test/gouda/test_helper.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ def truncate_test_tables
5858

5959
def subscribed_notification_for(notification)
6060
payload = nil
61-
subscription = ActiveSupport::Notifications.subscribe notification do |name, start, finish, id, _payload|
62-
payload = _payload
61+
subscription = ActiveSupport::Notifications.subscribe notification do |name, start, finish, id, local_payload|
62+
payload = local_payload
6363
end
6464

6565
yield
6666

6767
ActiveSupport::Notifications.unsubscribe(subscription)
6868

69-
return payload
69+
payload
7070
end
7171
end

0 commit comments

Comments
 (0)