deimos-ruby 2.5.3 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 634ebcbb254c467794eae6a3971200e2647472769eb59b6e8e89ed9453c3b203
4
- data.tar.gz: a72e4063b395f3a5388bc2988b3780e8fb9a8aa9052152f7c08b1f3469fc63f3
3
+ metadata.gz: cd09242a06bc94c004fb1fbeff2f6462e3b94d9aefce48894a1378eafdad1aa6
4
+ data.tar.gz: 1d9c45e6048b08216fc9ef6c424c204c02d14d661e33a516da7c248cc8667e6a
5
5
  SHA512:
6
- metadata.gz: 1205344ccc7c9f97b5b0496e950d5a5e385654c0e1192ba8d6e1fa6f6c01fdd2a84c88f1980c587f2623717ca5eafd6562fc3fb713f3cd04b0d54d3382645385
7
- data.tar.gz: 15589b978f07ce93acfda561f8e8cb75f6a9ad1be25efd77942b5c04b9404237112c9668a1b6f295c94983848fcb18916b0c32a134daa208b8d7343ef845ee5b
6
+ metadata.gz: 34bed6ee88463b0345bb3d361bc489d57fdc1acbe472937b49e8ef6ae552e4cf9b9ca390606f180aeeebfb5864646dd45dd4fe3b1a6e35fa752d9d3fa65ee6c3
7
+ data.tar.gz: cd7df7022342e21b40c1d68b6696f0026bbaff946e34b04de7cc4ca46fc82930c0fa19316150196ddf5bf19bf1f908116ffedc380e332a5c9352d954e063bf69
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 2.5.4 - 2026-07-15
11
+
12
+ - Fix: `DeadlockRetry.wrap` coerces its `tags` argument with `Array(...)`, so a scalar topic String (passed by `MassUpdater`/batch consumption) no longer raises `NoMethodError` on `String#to_a` inside the rescue, which had defeated the deadlock retry on the first deadlock.
13
+
10
14
  ## 2.5.3 - 2026-04-28
11
15
 
12
16
  - Fix: `setup_karafka` applies the merged kafka config to `Karafka.producer`, so kafka overrides set in later `Karafka::App.setup` calls take effect on `Karafka.producer` callers (Karafka::Web, DLQ, ActiveJob).
@@ -28,10 +28,15 @@ module Deimos
28
28
  # be wrapped in a transaction.
29
29
  # Sleeps for a random number of seconds to prevent multiple transactions
30
30
  # from retrying at the same time.
31
- # @param tags [Array] Tags to attach when logging and reporting metrics.
31
+ # @param tags [Array, String, nil] Tags to attach when logging and reporting metrics.
32
+ # A scalar (e.g. a topic String) is coerced to a single-element array.
32
33
  # @yield Yields to the block that may deadlock.
33
34
  # @return [void]
34
35
  def wrap(tags=[])
36
+ # Normalize to an Array so downstream logging/metrics (and dogstatsd's
37
+ # `tags.to_a`) never receive a bare String, which would raise
38
+ # NoMethodError inside this rescue and defeat the retry mechanism.
39
+ tags = Array(tags)
35
40
  count = RETRY_COUNT
36
41
 
37
42
  begin
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '2.5.3'
4
+ VERSION = '2.5.4'
5
5
  end
@@ -62,7 +62,7 @@ module ConsumerTest
62
62
  'some_int' => 123 }) do |payload, _metadata|
63
63
  expect(payload['test_id']).to eq('foo')
64
64
  expect(payload['some_int']).to eq(123)
65
- end
65
+ end
66
66
  end
67
67
 
68
68
  it 'should consume a nil message' do
@@ -77,7 +77,7 @@ module ConsumerTest
77
77
  'some_int' => 123 }) do |payload, _metadata|
78
78
  expect(payload['test_id']).to eq('foo')
79
79
  expect(payload['some_int']).to eq(123)
80
- end
80
+ end
81
81
  end
82
82
 
83
83
  it 'should fail on invalid message' do
@@ -196,7 +196,7 @@ module ConsumerTest
196
196
  expect(payload['test_id']).to eq('foo')
197
197
  expect(payload['some_int']).to eq(1)
198
198
  expect(payload['super_int']).to eq(9000)
199
- end
199
+ end
200
200
  end
201
201
 
202
202
  end
@@ -255,7 +255,7 @@ module ConsumerTest
255
255
  expect(payload['some_nested_record']['some_int']).to eq(1)
256
256
  expect(payload.to_h).not_to have_key('additional_field')
257
257
  expect(payload.to_h['some_nested_record']).not_to have_key('additional_field')
258
- end
258
+ end
259
259
 
260
260
  end
261
261
  end
@@ -55,6 +55,26 @@ RSpec.describe Deimos::Utils::DeadlockRetry do
55
55
  expect(Widget.all).to contain_exactly(have_attributes(test_id: 'first'), have_attributes(test_id: 'second'))
56
56
  end
57
57
 
58
+ it 'should coerce a scalar tag to an array when reporting metrics' do
59
+ # Regression: mass_updater passes get_tag('topic') (a String) as tags.
60
+ # dogstatsd calls tags.to_a, which raises NoMethodError on a String and
61
+ # would defeat the retry mechanism on the first deadlock.
62
+ metrics = instance_double(Deimos::Metrics::Provider)
63
+ allow(Deimos.config).to receive(:metrics).and_return(metrics)
64
+ expect(metrics).to receive(:increment).with('deadlock', tags: ['Flyers.FlyerItem']).twice
65
+
66
+ expect(Widget).
67
+ to receive(:create).
68
+ and_raise(ActiveRecord::Deadlocked.new('Lock wait timeout exceeded')).
69
+ exactly(3).times
70
+
71
+ expect {
72
+ described_class.wrap('Flyers.FlyerItem') do
73
+ Widget.create(test_id: 'abc')
74
+ end
75
+ }.to raise_error(ActiveRecord::Deadlocked)
76
+ end
77
+
58
78
  it 'should not retry non-deadlock exceptions' do
59
79
  expect(Widget).
60
80
  to receive(:create).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deimos-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
@@ -711,7 +711,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
711
711
  - !ruby/object:Gem::Version
712
712
  version: '0'
713
713
  requirements: []
714
- rubygems_version: 4.0.6
714
+ rubygems_version: 4.0.16
715
715
  specification_version: 4
716
716
  summary: Kafka libraries for Ruby.
717
717
  test_files: []