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 +4 -4
- data/.github/workflows/ci.yml +4 -4
- data/CHANGELOG +6 -0
- data/README.md +1 -1
- data/lib/message_bus/backends/redis.rb +12 -34
- data/lib/message_bus/version.rb +1 -1
- data/lib/message_bus.rb +4 -2
- data/spec/integration/http_client_spec.rb +0 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 357d1643581a819f8b51412902cf1e3c666d87f8971b1e56ae2d1d822a60c984
|
4
|
+
data.tar.gz: 86fe067d70065dab59e4a8a739fd040d858af8b4e7658a4e4bcb36c79d41514a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef5368939b9c41b4a9faf41ac10f621a07d26d15760d6a5ab5dcc3eb6cc9f845923fc1400761fe2911fcb85f9eab8016778c20127228112618f67c0ccb77c238
|
7
|
+
data.tar.gz: f2cfded03670efd4d8f3098002a4709781b4f59e98c6f19102f462f5965aa51cfd6a11b4dcacd4b82470305cd85d04a6ce623029e2c0dde2ad7cbad1ca8b3fc8
|
data/.github/workflows/ci.yml
CHANGED
@@ -36,7 +36,7 @@ jobs:
|
|
36
36
|
|
37
37
|
test:
|
38
38
|
runs-on: ubuntu-latest
|
39
|
-
name: Ruby ${{ matrix.ruby }} (
|
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: ["
|
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: ${{
|
63
|
+
image: ${{ matrix.redis }}
|
64
64
|
ports:
|
65
65
|
- 6379:6379
|
66
66
|
options: >-
|
data/CHANGELOG
CHANGED
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 [
|
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]
|
44
|
-
# @option
|
45
|
-
# @option
|
46
|
-
# @option
|
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(
|
49
|
-
@
|
50
|
-
@
|
51
|
-
@
|
52
|
-
@
|
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
|
-
|
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
|
data/lib/message_bus/version.rb
CHANGED
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(
|
187
|
+
configure(backend: :redis, redis_config: config)
|
188
188
|
end
|
189
189
|
|
190
|
-
|
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.
|
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-
|
10
|
+
date: 2025-03-14 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rack
|