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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89229a2e20ef4e018c1e483fc24784fca853901f589fc25eabaca7cefa88d195
4
- data.tar.gz: 36ec7e44a6223a60f4e51a937977ba74122e8ac36c8e5df9551beb5b0a3d679d
3
+ metadata.gz: 2df4ed426f8b349c63bd56de7f73f846a65cef0a689de7c3d5a017a7eabaf2ac
4
+ data.tar.gz: a1f05881617167d9b680c8a1ac192fdd02dea903e1ff4b5fa692fe26c4533633
5
5
  SHA512:
6
- metadata.gz: f8847a0e7fd1f836000bda6ef017c498697489f84cf437732feab601b2a9c924aa981f4e96457360e36647568a00246e728459918a91afbda1e7b86e757f6520
7
- data.tar.gz: 9217b0226498fca5fd7dc4159d72b5c86d0f588dff13cf1ddf8e3b8ce4d5f04fcb42f03cb4310233100603391f90ac6d1a8b1ee0a1cf4281ab2e1275799f7907
6
+ metadata.gz: a9feb43d0b0725bcc3190704f9f673bf3b7ce2e6d1c5c6e70212f21ebad241e082c0095ed08b1144d73cbef50f0585f858cc4cd1215e72e668eeb37df4d2f1bd
7
+ data.tar.gz: e69da95765f2017b005977486f4be3077055357b9ff17a70894a4a0d95c2e9fa02cd2b50dc14d301961d07eccb097733be378f2b05fb3edbd0c1b9a32376999c
@@ -1,9 +1,9 @@
1
1
  before_install: gem install bundler
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4
5
4
  - 2.5
6
5
  - 2.6
6
+ - 2.7
7
7
  gemfile:
8
8
  - Gemfile
9
9
  addons:
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
@@ -365,13 +365,17 @@ module MessageBus::Implementation
365
365
  client_ids: client_ids
366
366
  )
367
367
 
368
- channel_opts = nil
368
+ channel_opts = {}
369
369
 
370
- if opts && ((age = opts[:max_backlog_age]) || (size = opts[:max_backlog_size]))
371
- channel_opts = {
372
- max_backlog_size: size,
373
- max_backlog_age: 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
- begin
80
- @message_bus.publish(CHANNEL_NAME, message, user_ids: [-1])
81
- rescue => e
82
- @message_bus.logger.warn("DistributedCache failed to publish: #{e.message}\n#{e.backtrace.join("\n")}")
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
- @thread.wakeup if running
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MessageBus
4
- VERSION = "3.3.2"
4
+ VERSION = "3.3.3"
5
5
  end
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.2
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-15 00:00:00.000000000 Z
11
+ date: 2020-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack