Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.3.7)
connection_pool (3.0.2)
crass (1.0.6)
crass (1.0.7)
csv (3.3.5)
database_cleaner-active_record (2.2.2)
activerecord (>= 5.a)
Expand All @@ -127,12 +127,12 @@ GEM
railties (>= 6.1.0)
ffi (1.17.1)
fiber-storage (0.1.2)
fugit (1.12.1)
fugit (1.12.3)
et-orbi (~> 1.4)
raabro (~> 1.4)
globalid (1.3.0)
activesupport (>= 6.1)
good_job (4.19.0)
good_job (4.19.1)
activejob (>= 6.1.0)
activerecord (>= 6.1.0)
concurrent-ruby (>= 1.3.1)
Expand Down Expand Up @@ -208,7 +208,7 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.5)
nokogiri (1.19.3)
nokogiri (1.19.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
open3 (0.2.1)
Expand All @@ -217,7 +217,7 @@ GEM
ast (~> 2.4.1)
racc
pg (1.6.3)
pp (0.6.3)
pp (0.6.4)
prettyprint
prettyprint (0.2.0)
prism (1.9.0)
Expand Down
26 changes: 26 additions & 0 deletions lib/sagittarius/middleware/good_job/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@ def cleanup_preserved_jobs(event)
end
end

def enqueue_concurrency_limit_exceeded(event)
job = event.payload[:job]
in_context do
logger.info(
message: 'Aborted enqueue of job because concurrency key has reached enqueue limit',
job_class: job.class.name,
execution_id: job.id,
concurrency_key: event.payload[:key],
concurrency_limit: event.payload[:limit]
)
end
end

def enqueue_concurrency_throttle_exceeded(event)
job = event.payload[:job]
in_context do
logger.info(
message: 'Aborted enqueue of job because concurrency key has reached throttle limit',
job_class: job.class.name,
execution_id: job.id,
concurrency_key: event.payload[:key],
concurrency_limit: event.payload[:limit]
)
end
end

def systemd_watchdog_start(event)
in_context { logger.info(message: 'Pinging systemd watchdog', interval_s: event.payload[:interval]) }
end
Expand Down
11 changes: 11 additions & 0 deletions spec/application_state_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@

describe 'good_job' do
it { expect(GoodJob.migrated?).to be true }

it 'log subscriber overrides all log messages' do
ignored_overrides = %i[info fatal debug unknown error warn logger]

GoodJob::LogSubscriber.instance_methods(false).each do |method|
next if ignored_overrides.include?(method)

expect(Sagittarius::Middleware::GoodJob::LogSubscriber.method_defined?(method, false))
.to be(true), "#{Sagittarius::Middleware::GoodJob::LogSubscriber} should define #{method}"
end
end
end
end
# rubocop:enable RSpec/DescribeClass