jetstream_bridge 7.1.2 → 7.1.3

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: 45dac84dd11b563f4f5b0b3d52d85722fdb5b7900923d85f7d6cb7af9b0fad95
4
- data.tar.gz: a53400f90050c039fa8ac72109a99e3778911200fab983efa6f18549bcf5620f
3
+ metadata.gz: 960c62e2e115e43f9e9f850adda06a2fd9337a72ad0eb09f1b0e99be53b4b0c3
4
+ data.tar.gz: 011f110e84e31b9fbc69c388c34d4c1be47bba2bb44ba4c5a1f5ce8318aa7e8a
5
5
  SHA512:
6
- metadata.gz: 9e1790cb302107920d71736110db8bc19ae08ac111725614bb4221c73daddf4a992fea8c5c9913cc8dfeea7ebb4bcad359d189e691cd6cf45c1e7bb516b708c1
7
- data.tar.gz: 60ee52e1c6943c8fb0c95cb7ea7f2b12d18d914fd2f03981134deaf6c5bef95680671d25ed66585914299216e70fc25f924dcf66925da7076687f95e6ee9b29d
6
+ metadata.gz: 89233b76d7cf91b0977e78ec9b08fc12ddec28361da16db0fe84ea573e36fd49491515809ecd8ae1de583869974e5a123808dee98366bf0ce0ec6acd52e64402
7
+ data.tar.gz: 3e15d5f11c6407af7bd76cd11ac1978bd6fe663d9f72fb08e3f284f7138f8bc12454b3a46f0e3341d8f3c4132e4849e040a09b296708cef1ea16b63659aacf68
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [7.1.3] - 2026-02-13
9
+
10
+ ### Fixed
11
+
12
+ - **Publish recovery for transient JetStream context loss** - `JetstreamBridge.publish` now catches `ConnectionNotEstablishedError`, performs a reconnect, and retries once so publish calls no longer fail immediately during brief JetStream context refresh windows.
13
+ - **Initialized-but-stale connection recovery** - Internal `connect_if_needed!` now validates that a JetStream context is actually available (not just that startup previously ran) and triggers reconnect when context refresh is pending or failed.
14
+
8
15
  ## [7.1.2] - 2026-02-11
9
16
 
10
17
  ### Fixed
@@ -14,9 +14,24 @@ module JetstreamBridge
14
14
  # Automatically connects on first use if not already connected
15
15
  # Thread-safe and idempotent
16
16
  def connect_if_needed!
17
- return if @connection_initialized
17
+ unless @connection_initialized
18
+ startup!
19
+ return
20
+ end
21
+
22
+ return if Connection.jetstream
18
23
 
19
- startup!
24
+ Logging.warn(
25
+ 'JetStream context unavailable on initialized connection. Attempting reconnect before operation.',
26
+ tag: 'JetstreamBridge'
27
+ )
28
+ reconnect!
29
+ rescue ConnectionNotEstablishedError
30
+ Logging.warn(
31
+ 'JetStream context unavailable on initialized connection. Attempting reconnect before operation.',
32
+ tag: 'JetstreamBridge'
33
+ )
34
+ reconnect!
20
35
  end
21
36
 
22
37
  # Enforce rate limit on uncached health checks to prevent abuse
@@ -4,5 +4,5 @@
4
4
  #
5
5
  # Version constant for the gem.
6
6
  module JetstreamBridge
7
- VERSION = '7.1.2'
7
+ VERSION = '7.1.3'
8
8
  end
@@ -322,10 +322,21 @@ module JetstreamBridge
322
322
  # logger.error("Publish failed: #{result.error}")
323
323
  # end
324
324
  def publish(event_or_hash = nil, resource_type: nil, event_type: nil, payload: nil, subject: nil, **)
325
- connect_if_needed!
326
- publisher = Publisher.new
327
- publisher.publish(event_or_hash, resource_type: resource_type, event_type: event_type, payload: payload,
328
- subject: subject, **)
325
+ retried_after_reconnect = false
326
+ begin
327
+ connect_if_needed!
328
+ publisher = Publisher.new
329
+ publisher.publish(event_or_hash, resource_type: resource_type, event_type: event_type, payload: payload,
330
+ subject: subject, **)
331
+ rescue ConnectionNotEstablishedError => e
332
+ raise if retried_after_reconnect
333
+
334
+ retried_after_reconnect = true
335
+ Logging.warn("JetStream context unavailable during publish: #{e.message}. Reconnecting and retrying once.",
336
+ tag: 'JetstreamBridge')
337
+ reconnect!
338
+ retry
339
+ end
329
340
  end
330
341
 
331
342
  # Publish variant that raises on error
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jetstream_bridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.2
4
+ version: 7.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Attara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-11 00:00:00.000000000 Z
11
+ date: 2026-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord