message_bus 4.3.9 → 4.4.0

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: 258a314e3749265bd7fbaa9fadcaba10a3e4fdb46d204787ccc96effecdcbc7c
4
- data.tar.gz: b14add0ef9b398c2adf721adb725d7dbeb2719066f694e753fde7073a06da502
3
+ metadata.gz: 357d1643581a819f8b51412902cf1e3c666d87f8971b1e56ae2d1d822a60c984
4
+ data.tar.gz: 86fe067d70065dab59e4a8a739fd040d858af8b4e7658a4e4bcb36c79d41514a
5
5
  SHA512:
6
- metadata.gz: ebc4a907f665282f748fef892398b203b71888c98800350d7061ee870d7848a8a3f1034d501ccb162c5d099dee9edbc411a950921ce063ccac7a7ac58e60e995
7
- data.tar.gz: 9b454a1f78c88351865bb277c2831b4f9772113ad865793f7d05ef531816600f828a4cc18f461a969db002038a30b5ae2d472bdd4128b7a0ccf8d2bfab6e6067
6
+ metadata.gz: ef5368939b9c41b4a9faf41ac10f621a07d26d15760d6a5ab5dcc3eb6cc9f845923fc1400761fe2911fcb85f9eab8016778c20127228112618f67c0ccb77c238
7
+ data.tar.gz: f2cfded03670efd4d8f3098002a4709781b4f59e98c6f19102f462f5965aa51cfd6a11b4dcacd4b82470305cd85d04a6ce623029e2c0dde2ad7cbad1ca8b3fc8
@@ -36,7 +36,7 @@ jobs:
36
36
 
37
37
  test:
38
38
  runs-on: ubuntu-latest
39
- name: Ruby ${{ matrix.ruby }} (redis ${{ matrix.redis }})
39
+ name: Ruby ${{ matrix.ruby }} (${{ matrix.redis }})
40
40
  timeout-minutes: 10
41
41
 
42
42
  env:
@@ -47,8 +47,8 @@ jobs:
47
47
  strategy:
48
48
  fail-fast: false
49
49
  matrix:
50
- ruby: ["2.6", "2.7", "3.0", "3.1"]
51
- redis: [5, 6]
50
+ ruby: ["3.2", "3.3", "3.4"]
51
+ redis: ["redis:5", "redis:6", "valkey/valkey"]
52
52
 
53
53
  services:
54
54
  postgres:
@@ -60,7 +60,7 @@ jobs:
60
60
  - 5432:5432
61
61
  options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
62
62
  redis:
63
- image: ${{ format('redis:{0}', matrix.redis) }}
63
+ image: ${{ matrix.redis }}
64
64
  ports:
65
65
  - 6379:6379
66
66
  options: >-
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 14-03-2025
2
+
3
+ - Version 4.4.0
4
+
5
+ - Add compatibility with the redis gem version 5+.
6
+
1
7
  18-02-2025
2
8
 
3
9
  - Version 4.3.9
data/README.md CHANGED
@@ -12,7 +12,7 @@ Read the generated docs: <https://www.rubydoc.info/gems/message_bus>
12
12
 
13
13
  ## Ruby version support
14
14
 
15
- MessageBus only support officially supported versions of Ruby; as of [2021-03-31](https://www.ruby-lang.org/en/downloads/branches/) this means we only support Ruby version 2.6 and up.
15
+ MessageBus only support officially supported versions of Ruby; as of [2025-03-14](https://www.ruby-lang.org/en/downloads/branches/) this means we only support Ruby version 3.2 and up.
16
16
 
17
17
  ## Can you handle concurrent requests?
18
18
 
@@ -40,16 +40,18 @@ module MessageBus
40
40
  end
41
41
  end
42
42
 
43
- # @param [Hash] redis_config in addition to the options listed, see https://github.com/redis/redis-rb for other available options
44
- # @option redis_config [Logger] :logger a logger to which logs will be output
45
- # @option redis_config [Boolean] :enable_redis_logger (false) whether or not to enable logging by the underlying Redis library
46
- # @option redis_config [Integer] :clear_every (1) the interval of publications between which the backlog will not be cleared
43
+ # @param [Hash] config
44
+ # @option config [Hash] :redis_config options for the redis connection (see https://github.com/redis/redis-rb)
45
+ # @option config [Logger] :logger a logger to which logs will be output
46
+ # @option config [Boolean] :enable_redis_logger (false) whether or not to enable logging by the underlying Redis library
47
+ # @option config [Integer] :clear_every (1) the interval of publications between which the backlog will not be cleared
47
48
  # @param [Integer] max_backlog_size the largest permitted size (number of messages) for per-channel backlogs; beyond this capacity, old messages will be dropped.
48
- def initialize(redis_config = {}, max_backlog_size = 1000)
49
- @redis_config = redis_config.dup
50
- @clear_every = redis_config.delete(:clear_every) || 1
51
- @logger = @redis_config[:logger]
52
- @redis_config[:logger] = nil unless @redis_config[:enable_redis_logger]
49
+ def initialize(config = {}, max_backlog_size = 1000)
50
+ @config = config.dup
51
+ @redis_config = config[:redis_config].dup || {}
52
+ @clear_every = config[:clear_every] || 1
53
+ @logger = @config[:logger]
54
+ @config[:logger] = nil unless @config[:enable_redis_logger]
53
55
  @max_backlog_size = max_backlog_size
54
56
  @max_global_backlog_size = 2000
55
57
  @max_in_memory_publish_backlog = 1000
@@ -331,31 +333,7 @@ LUA
331
333
  private
332
334
 
333
335
  def new_redis_connection
334
- config =
335
- @redis_config.filter do |k, v|
336
- # This is not ideal, required for Redis gem version 5
337
- # redis-client no longer accepts arbitrary params
338
- # anything unknown will error out.
339
- # https://github.com/redis-rb/redis-client/blob/4c8e05acfb3477c1651138a4924616e79e6116f2/lib/redis_client/config.rb#L21-L39
340
- #
341
- #
342
- # We should be doing the opposite and allowlisting params
343
- # or splitting the object up. Starting with the smallest change that is backwards compatible
344
- !%i[
345
- backend
346
- logger
347
- long_polling_enabled
348
- long_polling_interval
349
- backend_options
350
- base_route
351
- client_message_filters
352
- site_id_lookup
353
- group_ids_lookup
354
- user_id_lookup
355
- transport_codec
356
- ].include?(k)
357
- end
358
- ::Redis.new(config)
336
+ ::Redis.new(@redis_config)
359
337
  end
360
338
 
361
339
  # redis connection used for publishing messages
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MessageBus
4
- VERSION = "4.3.9"
4
+ VERSION = "4.4.0"
5
5
  end
data/lib/message_bus.rb CHANGED
@@ -184,10 +184,12 @@ module MessageBus::Implementation
184
184
  # @param [Hash<Symbol => Object>] config values to merge into existing config
185
185
  # @return [void]
186
186
  def redis_config=(config)
187
- configure(config.merge(backend: :redis))
187
+ configure(backend: :redis, redis_config: config)
188
188
  end
189
189
 
190
- alias redis_config config
190
+ def redis_config
191
+ @config[:redis_config] || {}
192
+ end
191
193
 
192
194
  # @yield [env] a routine to determine the site ID for a subscriber
193
195
  # @yieldparam [optional, Rack::Request::Env] env the subscriber request environment
@@ -16,14 +16,8 @@ describe MessageBus::HTTPClient do
16
16
  assert_equal("200", response.code)
17
17
  end
18
18
 
19
- before do
20
- @threads = Thread.list
21
- end
22
-
23
19
  after do
24
- new_threads = Thread.list - @threads
25
20
  client.stop
26
- new_threads.each(&:join)
27
21
  end
28
22
 
29
23
  describe '#start and #stop' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_bus
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.9
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-18 00:00:00.000000000 Z
10
+ date: 2025-03-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rack