message_bus 3.3.2 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of message_bus might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG +16 -0
- data/lib/message_bus.rb +10 -6
- data/lib/message_bus/distributed_cache.rb +6 -7
- data/lib/message_bus/timer_thread.rb +8 -1
- data/lib/message_bus/version.rb +1 -1
- 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: 2df4ed426f8b349c63bd56de7f73f846a65cef0a689de7c3d5a017a7eabaf2ac
|
4
|
+
data.tar.gz: a1f05881617167d9b680c8a1ac192fdd02dea903e1ff4b5fa692fe26c4533633
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9feb43d0b0725bcc3190704f9f673bf3b7ce2e6d1c5c6e70212f21ebad241e082c0095ed08b1144d73cbef50f0585f858cc4cd1215e72e668eeb37df4d2f1bd
|
7
|
+
data.tar.gz: e69da95765f2017b005977486f4be3077055357b9ff17a70894a4a0d95c2e9fa02cd2b50dc14d301961d07eccb097733be378f2b05fb3edbd0c1b9a32376999c
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
- Unrelease
|
2
2
|
|
3
|
+
18-09-2020
|
4
|
+
|
5
|
+
- Version 3.3.3
|
6
|
+
|
7
|
+
- FIX: `queue_in_memory` option not being passed to the backends.
|
8
|
+
- FIX: `MessageBus::DistributedCache#publish` should raise on error.
|
9
|
+
|
10
|
+
On the redis backend, any errors encountered during `MessageBus#publish`
|
11
|
+
will add the message into an in memory queue and silently swallow the
|
12
|
+
error. While this is behavior is OK for normal message_bus usage, it may
|
13
|
+
lead to inconsistency when using `DistributedCache`. If a process
|
14
|
+
doesn't publish successfully to another process, it will still update
|
15
|
+
its in memory cache leaving the other processes unaware. As such, the
|
16
|
+
distributed cache is out of sync and will require another successful
|
17
|
+
write to the cache to resync all the caches.
|
18
|
+
|
3
19
|
15-09-2020
|
4
20
|
|
5
21
|
- Version 3.3.2
|
data/lib/message_bus.rb
CHANGED
@@ -365,13 +365,17 @@ module MessageBus::Implementation
|
|
365
365
|
client_ids: client_ids
|
366
366
|
)
|
367
367
|
|
368
|
-
channel_opts =
|
368
|
+
channel_opts = {}
|
369
369
|
|
370
|
-
if opts
|
371
|
-
|
372
|
-
max_backlog_size
|
373
|
-
max_backlog_age
|
374
|
-
|
370
|
+
if opts
|
371
|
+
if ((age = opts[:max_backlog_age]) || (size = opts[:max_backlog_size]))
|
372
|
+
channel_opts[:max_backlog_size] = size,
|
373
|
+
channel_opts[:max_backlog_age] = age
|
374
|
+
end
|
375
|
+
|
376
|
+
if opts.has_key?(:queue_in_memory)
|
377
|
+
channel_opts[:queue_in_memory] = opts[:queue_in_memory]
|
378
|
+
end
|
375
379
|
end
|
376
380
|
|
377
381
|
encoded_channel_name = encode_channel_name(channel, site_id)
|
@@ -16,11 +16,12 @@ module MessageBus
|
|
16
16
|
|
17
17
|
attr_accessor :app_version
|
18
18
|
|
19
|
-
def initialize(message_bus = nil)
|
19
|
+
def initialize(message_bus = nil, publish_queue_in_memory: true)
|
20
20
|
@subscribers = []
|
21
21
|
@subscribed = false
|
22
22
|
@lock = Mutex.new
|
23
23
|
@message_bus = message_bus || MessageBus
|
24
|
+
@publish_queue_in_memory = publish_queue_in_memory
|
24
25
|
end
|
25
26
|
|
26
27
|
def subscribers
|
@@ -76,12 +77,10 @@ module MessageBus
|
|
76
77
|
message[:hash_key] = hash.key
|
77
78
|
message[:app_version] = @app_version if @app_version
|
78
79
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
raise
|
84
|
-
end
|
80
|
+
@message_bus.publish(CHANNEL_NAME, message,
|
81
|
+
user_ids: [-1],
|
82
|
+
queue_in_memory: @publish_queue_in_memory
|
83
|
+
)
|
85
84
|
end
|
86
85
|
|
87
86
|
def set(hash, key, value)
|
@@ -45,7 +45,14 @@ class MessageBus::TimerThread
|
|
45
45
|
while running
|
46
46
|
@mutex.synchronize do
|
47
47
|
running = @thread && @thread.alive?
|
48
|
-
|
48
|
+
|
49
|
+
if running
|
50
|
+
begin
|
51
|
+
@thread.wakeup
|
52
|
+
rescue ThreadError
|
53
|
+
raise if @thread.alive?
|
54
|
+
end
|
55
|
+
end
|
49
56
|
end
|
50
57
|
sleep 0
|
51
58
|
end
|
data/lib/message_bus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: message_bus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|