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
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
journaled (6.2.5)
journaled (6.2.6)
activejob
activerecord
activesupport
Expand Down Expand Up @@ -258,4 +258,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.6.3
4.0.7
4 changes: 2 additions & 2 deletions gemfiles/rails_7_2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
journaled (6.2.5)
journaled (6.2.6)
activejob
activerecord
activesupport
Expand Down Expand Up @@ -258,4 +258,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.6.3
4.0.7
4 changes: 2 additions & 2 deletions gemfiles/rails_8_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
journaled (6.2.5)
journaled (6.2.6)
activejob
activerecord
activesupport
Expand Down Expand Up @@ -259,4 +259,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.6.3
4.0.7
3 changes: 2 additions & 1 deletion lib/journaled/outbox/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ def run_loop
break
end

emit_metrics_if_needed

begin
process_batch
emit_metrics_if_needed
rescue StandardError => e
Rails.logger.error("Worker error: #{e.class} - #{e.message}")
Rails.logger.error(e.backtrace.join("\n"))
Expand Down
2 changes: 1 addition & 1 deletion lib/journaled/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Journaled
VERSION = "6.2.5"
VERSION = "6.2.6"
end
22 changes: 22 additions & 0 deletions spec/lib/journaled/outbox/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,28 @@
worker.start
expect(processor).to have_received(:process_batch).at_least(:twice)
end

it 'still emits queue metrics after errors' do
call_count = 0
allow(processor).to receive(:process_batch) do
call_count += 1
Timecop.travel(61.seconds) if call_count == 1
worker.shutdown if call_count >= 2
raise StandardError, 'Kinesis error'
end

emitted = {}
callback = ->(name, _started, _finished, _unique_id, payload) { emitted[name] = payload }

ActiveSupport::Notifications.subscribed(callback, /journaled\.worker\.queue_/) do
worker.start

timeout = 2.seconds.from_now
sleep 0.1 until emitted.key?('journaled.worker.queue_total_count') || Time.current > timeout
end

expect(emitted).to have_key('journaled.worker.queue_total_count')
end
end
end

Expand Down
Loading