FIX: `MessageBus::DistributedCache#publish` should raise on error.

FIX: MessageBus::DistributedCache#publish should raise on error.

On the redis backend, any errors encountered during MessageBus#publish will add the message into an in memory queue and silently swallow the error. While this is behavior is OK for normal message_bus usage, it may lead to inconsistency when using DistributedCache. If a process doesn’t publish successfully to another process, it will still update its in memory cache leaving the other processes unaware. As such, the distributed cache is out of sync and will require another successful write to the cache to resync all the caches.

diff --git a/lib/message_bus/distributed_cache.rb b/lib/message_bus/distributed_cache.rb
index 4cc23c1..15404d5 100644
--- a/lib/message_bus/distributed_cache.rb
+++ b/lib/message_bus/distributed_cache.rb
@@ -75,13 +75,7 @@ module MessageBus
         message[:origin] = hash.identity
         message[:hash_key] = hash.key
         message[:app_version] = @app_version if @app_version
-        begin
-          @message_bus.publish(CHANNEL_NAME, message, user_ids: [-1])
-        rescue => e
-          @message_bus.logger.warn("DistributedCache failed to publish: #{e.message}\n#{e.backtrace.join("\n")}")
-          raise
-        end
+        @message_bus.publish(CHANNEL_NAME, message, user_ids: [-1], queue_in_memory: false)
       def set(hash, key, value)

GitHub sha: e91d4148