ears 0.22.1 → 0.22.2

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: 8ae7219688923da6df4b3d6939e91449621d143fe835362043a7032aaaff3b40
4
- data.tar.gz: 989c76721a48f2a91c8db1944746e598fdde624b47b9c598193de08a47df4798
3
+ metadata.gz: f6483233146640e82b3de7c02e3429615e31a7b231109846528735068054f9bb
4
+ data.tar.gz: 54a0f5b927c41292232f8f4c0926da9d7a9fd44457bc618ad99bf028ce13c41e
5
5
  SHA512:
6
- metadata.gz: 0cd3fac5b725c339d83d2953f7bffab29ed6ac0236d880af665e72308534e7154554dbcf42d74ec5c55db2a95a3fadd4b9283080ae87deb3900c388690b8df5d
7
- data.tar.gz: 7ca86de1d5545ea3b701c0d097f7925d27fbaa7e8536f6acfc8a0c5a1de9d51dbeea456ee2ded64768566f171f0a9dc6f5351057083b497c3080b56274f18f98
6
+ metadata.gz: da2668020244abab87e630625ea191f61cc2aacc45f08f59a194c0d4fc3e1e25445842f20349d8919c04738f3dcfecbb0979ea71d7b0249220e3f8148cfb1e7e
7
+ data.tar.gz: 525197d5ee63152fcaddb09af9339ad0c4ff054fcb8c0a3c74069b08f6a6f7beab5755522c13ae1c18be15716979badb0b9dd536e64ced620cf5ad537ae20a75
@@ -15,13 +15,13 @@ jobs:
15
15
  ruby-version: ['3.2', '3.3', '3.4']
16
16
 
17
17
  steps:
18
- - uses: actions/checkout@v4
18
+ - uses: actions/checkout@v5
19
19
  - name: Set up Ruby
20
20
  uses: ruby/setup-ruby@v1
21
21
  with:
22
22
  ruby-version: ${{ matrix.ruby-version }}
23
23
  bundler-cache: true
24
- - uses: actions/setup-node@v4
24
+ - uses: actions/setup-node@v5
25
25
  with:
26
26
  node-version: '24'
27
27
  - name: Run prettier
@@ -37,7 +37,7 @@ jobs:
37
37
  runs-on: ubuntu-latest
38
38
 
39
39
  steps:
40
- - uses: actions/checkout@v4
40
+ - uses: actions/checkout@v5
41
41
  - name: Set up Ruby
42
42
  uses: ruby/setup-ruby@v1
43
43
  with:
@@ -41,7 +41,7 @@ jobs:
41
41
 
42
42
  steps:
43
43
  - name: Checkout repository
44
- uses: actions/checkout@v4
44
+ uses: actions/checkout@v5
45
45
 
46
46
  # Initializes the CodeQL tools for scanning.
47
47
  - name: Initialize CodeQL
@@ -15,6 +15,6 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: 'Checkout Repository'
18
- uses: actions/checkout@v4
18
+ uses: actions/checkout@v5
19
19
  - name: 'Dependency Review'
20
20
  uses: actions/dependency-review-action@v4
data/.tool-versions CHANGED
@@ -1,2 +1,2 @@
1
1
  ruby 3.2.9
2
- nodejs 24.4.1
2
+ nodejs 24.8.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.22.2 (2025-01-19)
4
+
5
+ ### Fixed
6
+
7
+ - Publisher now proactively detects and recovers from closed channels before attempting to publish, preventing `Bunny::ChannelAlreadyClosed` errors when channels are closed by RabbitMQ (e.g., due to missing queues or other channel-level errors)
8
+
3
9
  ## 0.22.1 (2025-09-11)
4
10
 
5
11
  - Add optional `routing_key_match` parameter to `#published_messages` in `Ears::Testing::TestHelper`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ears (0.22.1)
4
+ ears (0.22.2)
5
5
  bunny (>= 2.22.0)
6
6
  connection_pool (~> 2.4)
7
7
  multi_json
@@ -14,7 +14,7 @@ GEM
14
14
  bunny (2.24.0)
15
15
  amq-protocol (~> 2.3)
16
16
  sorted_set (~> 1, >= 1.0.2)
17
- connection_pool (2.5.3)
17
+ connection_pool (2.5.4)
18
18
  diff-lcs (1.6.2)
19
19
  docile (1.4.1)
20
20
  json (2.13.2)
@@ -26,12 +26,12 @@ GEM
26
26
  ast (~> 2.4.1)
27
27
  racc
28
28
  prettier_print (1.2.1)
29
- prism (1.4.0)
29
+ prism (1.5.1)
30
30
  racc (1.8.1)
31
31
  rainbow (3.1.1)
32
32
  rake (13.3.0)
33
33
  rbtree (0.4.6)
34
- regexp_parser (2.10.0)
34
+ regexp_parser (2.11.3)
35
35
  rspec (3.13.1)
36
36
  rspec-core (~> 3.13.0)
37
37
  rspec-expectations (~> 3.13.0)
@@ -44,8 +44,8 @@ GEM
44
44
  rspec-mocks (3.13.5)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
46
  rspec-support (~> 3.13.0)
47
- rspec-support (3.13.4)
48
- rubocop (1.79.0)
47
+ rspec-support (3.13.5)
48
+ rubocop (1.80.2)
49
49
  json (~> 2.3)
50
50
  language_server-protocol (~> 3.17.0.2)
51
51
  lint_roller (~> 1.1.0)
@@ -55,7 +55,6 @@ GEM
55
55
  regexp_parser (>= 2.9.3, < 3.0)
56
56
  rubocop-ast (>= 1.46.0, < 2.0)
57
57
  ruby-progressbar (~> 1.7)
58
- tsort (>= 0.2.0)
59
58
  unicode-display_width (>= 2.4.0, < 4.0)
60
59
  rubocop-ast (1.46.0)
61
60
  parser (>= 3.3.7.2)
@@ -63,7 +62,7 @@ GEM
63
62
  rubocop-rake (0.7.1)
64
63
  lint_roller (~> 1.1)
65
64
  rubocop (>= 1.72.1)
66
- rubocop-rspec (3.6.0)
65
+ rubocop-rspec (3.7.0)
67
66
  lint_roller (~> 1.1)
68
67
  rubocop (~> 1.72, >= 1.72.1)
69
68
  ruby-progressbar (1.13.0)
@@ -79,10 +78,9 @@ GEM
79
78
  set (~> 1.0)
80
79
  syntax_tree (6.3.0)
81
80
  prettier_print (>= 1.2.0)
82
- tsort (0.2.0)
83
- unicode-display_width (3.1.4)
84
- unicode-emoji (~> 4.0, >= 4.0.4)
85
- unicode-emoji (4.0.4)
81
+ unicode-display_width (3.2.0)
82
+ unicode-emoji (~> 4.1)
83
+ unicode-emoji (4.1.0)
86
84
  yard (0.9.37)
87
85
 
88
86
  PLATFORMS
@@ -110,10 +108,10 @@ CHECKSUMS
110
108
  amq-protocol (2.3.4) sha256=98be5b9244e28dc66acc8351a254dbf45d996c5a0b7d49ab3ff8b72b0d2e6308
111
109
  ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
112
110
  bunny (2.24.0) sha256=072fe4ae98eaa9c95a17e4d166204f710bba8a9a7070b73a8c3b023f439d1682
113
- connection_pool (2.5.3) sha256=cfd74a82b9b094d1ce30c4f1a346da23ee19dc8a062a16a85f58eab1ced4305b
111
+ connection_pool (2.5.4) sha256=e9e1922327416091f3f6542f5f4446c2a20745276b9aa796dd0bb2fd0ea1e70a
114
112
  diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
115
113
  docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
116
- ears (0.22.1)
114
+ ears (0.22.2)
117
115
  json (2.13.2) sha256=02e1f118d434c6b230a64ffa5c8dee07e3ec96244335c392eaed39e1199dbb68
118
116
  language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
119
117
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
@@ -121,21 +119,21 @@ CHECKSUMS
121
119
  parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
122
120
  parser (3.3.9.0) sha256=94d6929354b1a6e3e1f89d79d4d302cc8f5aa814431a6c9c7e0623335d7687f2
123
121
  prettier_print (1.2.1) sha256=a72838b5f23facff21f90a5423cdcdda19e4271092b41f4ea7f50b83929e6ff9
124
- prism (1.4.0) sha256=dc0e3e00e93160213dc2a65519d9002a4a1e7b962db57d444cf1a71565bb703e
122
+ prism (1.5.1) sha256=b40c1b76ccb9fcccc3d1553967cda6e79fa7274d8bfea0d98b15d27a6d187134
125
123
  racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
126
124
  rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
127
125
  rake (13.3.0) sha256=96f5092d786ff412c62fde76f793cc0541bd84d2eb579caa529aa8a059934493
128
126
  rbtree (0.4.6) sha256=14eea4469b24fd2472542e5f3eb105d6344c8ccf36f0b56d55fdcfeb4e0f10fc
129
- regexp_parser (2.10.0) sha256=cb6f0ddde88772cd64bff1dbbf68df66d376043fe2e66a9ef77fcb1b0c548c61
127
+ regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
130
128
  rspec (3.13.1) sha256=b9f9a58fa915b8d94a1d6b3195fe6dd28c4c34836a6097015142c4a9ace72140
131
129
  rspec-core (3.13.5) sha256=ab3f682897c6131c67f9a17cfee5022a597f283aebe654d329a565f9937a4fa3
132
130
  rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
133
131
  rspec-mocks (3.13.5) sha256=e4338a6f285ada9fe56f5893f5457783af8194f5d08884d17a87321d5195ea81
134
- rspec-support (3.13.4) sha256=184b1814f6a968102b57df631892c7f1990a91c9a3b9e80ef892a0fc2a71a3f7
135
- rubocop (1.79.0) sha256=c709e83b16f9fced295d83d190a3a5bbcc46c419d8f9b85f259b99ba6faf5bbe
132
+ rspec-support (3.13.5) sha256=add745af535dd14b18f1209ab41ef987fdfad12786176b6a3b3619b9a7279fbf
133
+ rubocop (1.80.2) sha256=6485f30fefcf5c199db3b91e5e253b1ef43f7e564784e2315255809a3dd9abf4
136
134
  rubocop-ast (1.46.0) sha256=0da7f6ad5b98614f89b74f11873c191059c823eae07d6ffd40a42a3338f2232b
137
135
  rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
138
- rubocop-rspec (3.6.0) sha256=c0e4205871776727e54dee9cc91af5fd74578001551ba40e1fe1a1ab4b404479
136
+ rubocop-rspec (3.7.0) sha256=b7b214da112034db9c6d00f2d811a354847e870f7b6ed2482b29649c3d42058f
139
137
  ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
140
138
  set (1.1.2) sha256=ca33a60d202e788041d94a5d4c12315b1639875576f1a266f3a10913646d8ef1
141
139
  simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
@@ -143,10 +141,9 @@ CHECKSUMS
143
141
  simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
144
142
  sorted_set (1.0.3) sha256=4f2b8bee6e8c59cbd296228c0f1f81679357177a8b6859dcc2a99e86cce6372f
145
143
  syntax_tree (6.3.0) sha256=56e25a9692c798ec94c5442fe94c5e94af76bef91edc8bb02052cbdecf35f13d
146
- tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
147
- unicode-display_width (3.1.4) sha256=8caf2af1c0f2f07ec89ef9e18c7d88c2790e217c482bfc78aaa65eadd5415ac1
148
- unicode-emoji (4.0.4) sha256=2c2c4ef7f353e5809497126285a50b23056cc6e61b64433764a35eff6c36532a
144
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
145
+ unicode-emoji (4.1.0) sha256=4997d2d5df1ed4252f4830a9b6e86f932e2013fbff2182a9ce9ccabda4f325a5
149
146
  yard (0.9.37) sha256=a6e910399e78e613f80ba9add9ba7c394b1a935f083cccbef82903a3d2a26992
150
147
 
151
148
  BUNDLED WITH
152
- 2.7.1
149
+ 2.7.2
@@ -1,4 +1,5 @@
1
1
  require 'connection_pool'
2
+ require 'ears/publisher_retry_handler'
2
3
 
3
4
  module Ears
4
5
  # Channel pool management for publishers.
@@ -11,12 +12,15 @@ module Ears
11
12
  # @param [Boolean] confirms Whether to use a channel with publisher confirms enabled
12
13
  # @yieldparam [Bunny::Channel] channel The channel to use for publishing
13
14
  # @return [Object] The result of the block
14
- def with_channel(confirms: false, &)
15
+ def with_channel(confirms: false, &block)
15
16
  # CRITICAL: Preserve fork-safety at the entry point
16
17
  reset! if @creator_pid && @creator_pid != Process.pid
17
18
 
18
19
  pool = confirms ? confirms_pool : standard_pool
19
- pool.with(&)
20
+ pool.with do |channel|
21
+ validate_channel_health!(channel, confirms)
22
+ block.call(channel)
23
+ end
20
24
  end
21
25
 
22
26
  # Resets both channel pools, forcing new channels to be created.
@@ -97,6 +101,28 @@ module Ears
97
101
  def init_mutex
98
102
  @init_mutex ||= Mutex.new
99
103
  end
104
+
105
+ def validate_channel_health!(channel, confirms)
106
+ return if channel.open?
107
+
108
+ cleanup_closed_channel(channel)
109
+ reset_appropriate_pool(confirms)
110
+
111
+ raise PublisherRetryHandler::PublishToStaleChannelError,
112
+ 'Channel is closed'
113
+ end
114
+
115
+ def cleanup_closed_channel(channel)
116
+ return unless channel.respond_to?(:close)
117
+
118
+ channel.close
119
+ rescue StandardError
120
+ # Channel is already closed, ignore cleanup errors
121
+ end
122
+
123
+ def reset_appropriate_pool(confirms)
124
+ confirms ? reset_confirms_pool! : reset!
125
+ end
100
126
  end
101
127
  end
102
128
  end
@@ -35,7 +35,7 @@ module Ears
35
35
  rescue *NON_RETRYABLE_ERRORS => e
36
36
  raise e
37
37
  rescue *CONNECTION_ERRORS => e
38
- attempt = handle_connection_error(e, attempt) # rubocop:disable Lint/UselessAssignment
38
+ attempt = handle_connection_error(e, attempt)
39
39
  retry
40
40
  rescue StandardError => e
41
41
  attempt = handle_standard_error(e, attempt)
data/lib/ears/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ears
2
- VERSION = '0.22.1'
2
+ VERSION = '0.22.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ears
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - InVision AG
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-12 00:00:00.000000000 Z
11
+ date: 2025-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny