legion-transport 1.4.4 → 1.4.6

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: b3ac174e52fafff1a22693c787bf6de67c68cd0c2f63f29e6fe15c57aa53c143
4
- data.tar.gz: 7df5a08a287a077f48de4bb13dd93ed4e83b7614753bfa70068cb18e538de170
3
+ metadata.gz: 2020395943d7e4cdb8b830b8d950f09e6278088bf6826169fd4a59a935c36736
4
+ data.tar.gz: b64e42fce261b601b184ff0ec26d381ee18d7530a8c9cba0fcc68eda8f69a15b
5
5
  SHA512:
6
- metadata.gz: a38e99fdfd1ae7883bbd42b4610c77b6e4c96f54d8157f09624488cf377c98255e3b09a2d7454650528f9cbb1519ac0d26269003b8e09841503cbf6a44c031c1
7
- data.tar.gz: 6582bb4d39ec9f139c8a27cdb2249064e8ec4c9491b88338c82e01cedfbb2c00fc8b633c19532ec100726fd63136df841ce4705466a682824df5e4a2845ac17f
6
+ metadata.gz: ae230ce39595ed76fde09debdf05ff6c69a6f7108cf64a6d278dc0e43df343b0ef61fa6fac95cd8af87edd4650061ae07d3ce3e83811ea5ab2a6de5fabfc00a2
7
+ data.tar.gz: 9a1a089306d9495023d5394b5e957673312443424fd4654c324398fbad63383a788ac8f2f221e0d6eefc084aab4b3a416420a982b55ae2cbe8749316c0b9fb33
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Legion::Transport ChangeLog
2
2
 
3
+ ## [1.4.6] - 2026-03-27
4
+
5
+ ### Fixed
6
+ - `create_dedicated_session` in lite mode now returns the shared `InProcess::Session` (if open) rather than creating a new one, preventing `Session#close` from inadvertently resetting process-global in-memory queue state
7
+ - README "Full Default Settings" JSON corrected: `port` is now an integer (`5672`) matching the actual integer type in `Settings.connection`
8
+ - README "Dedicated Sessions" section updated to clarify that lite-mode sessions share process-global in-process transport and are not isolated from other sessions
9
+
10
+ ### Changed
11
+ - `spec/legion/transport/connection_lite_spec.rb` now explicitly requires `legion/transport/in_process` to ensure `InProcess::Session` is always loaded regardless of `LEGION_MODE` env var or spec execution order
12
+
13
+ ## [1.4.5] - 2026-03-27
14
+
15
+ ### Added
16
+ - `Connection.create_dedicated_session` class method for creating isolated AMQP connections separate from the main transport session; returns an `InProcess::Session` in lite mode
17
+
3
18
  ## [1.4.4] - 2026-03-26
4
19
 
5
20
  ### Removed
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Legion::Transport is the Ruby gem responsible for connecting LegionIO to its FIFO queue system (RabbitMQ over AMQP 0.9.1). It provides thread-safe connection management, exchange/queue abstractions, message publishing with optional encryption, and consumer wrappers.
4
4
 
5
- **Version**: 1.4.1
5
+ **Version**: 1.4.6
6
6
 
7
7
  ## Features
8
8
 
@@ -45,6 +45,16 @@ Legion::Transport::Connection.channel # => Bunny::Channel
45
45
  Legion::Transport::Connection.session # => Bunny::Session
46
46
  ```
47
47
 
48
+ ### Dedicated Sessions
49
+
50
+ `Connection.create_dedicated_session` creates a separate AMQP connection independent of the shared main session. Useful for consumers that need their own connection (e.g., a dedicated log channel or a build pipeline connection). In lite mode it returns the shared `InProcess::Session` (in-process transport is process-global; true session isolation is not available in lite mode).
51
+
52
+ ```ruby
53
+ session = Legion::Transport::Connection.create_dedicated_session(name: 'my-log-session')
54
+ channel = session.create_channel
55
+ # use channel independently of the main transport session
56
+ ```
57
+
48
58
  ### Publishing a Message
49
59
 
50
60
  ```ruby
@@ -141,25 +151,25 @@ Configuration is managed through `legion-settings` with environment variable ove
141
151
  }
142
152
  },
143
153
  "connection": {
144
- "read_timeout": 1,
154
+ "read_timeout": 3,
145
155
  "heartbeat": 30,
146
156
  "automatically_recover": true,
147
- "continuation_timeout": 4000,
148
- "network_recovery_interval": 1,
149
- "connection_timeout": 1,
157
+ "continuation_timeout": 8000,
158
+ "network_recovery_interval": 2,
159
+ "connection_timeout": 10,
150
160
  "frame_max": 65536,
151
161
  "user": "guest",
152
162
  "password": "guest",
153
163
  "host": "127.0.0.1",
154
- "port": "5672",
164
+ "port": 5672,
155
165
  "vhost": "/",
156
- "recovery_attempts": 100,
166
+ "recovery_attempts": 10,
157
167
  "logger_level": "info",
158
168
  "connected": false
159
169
  },
160
170
  "channel": {
161
171
  "default_worker_pool_size": 1,
162
- "session_worker_pool_size": 8
172
+ "session_worker_pool_size": 16
163
173
  }
164
174
  }
165
175
  ```
@@ -234,6 +234,31 @@ module Legion
234
234
  nil
235
235
  end
236
236
 
237
+ def create_dedicated_session(name: 'legion-dedicated')
238
+ if lite_mode?
239
+ # In-process transport is process-global; return the shared session so
240
+ # that callers do not inadvertently reset all queues via Session#close.
241
+ # Use an AtomicReference + compare_and_set so concurrent callers cannot
242
+ # each create a separate InProcess::Session (whose #close calls Local.reset!).
243
+ ref = (@session ||= Concurrent::AtomicReference.new(nil))
244
+
245
+ loop do
246
+ shared = ref.value
247
+ return shared if shared&.open?
248
+
249
+ s = Legion::Transport::InProcess::Session.new
250
+ s.start
251
+ # Install this session only if no other thread has won the race.
252
+ return s if ref.compare_and_set(shared, s)
253
+ # Another thread installed a session first; discard this one and retry.
254
+ end
255
+ end
256
+
257
+ sess = create_session_with_failover(connection_name: name)
258
+ sess.start
259
+ sess
260
+ end
261
+
237
262
  private
238
263
 
239
264
  def setup_pool(pool_size:, connection_name:)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Transport
5
- VERSION = '1.4.4'
5
+ VERSION = '1.4.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity