active_publisher 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e544e43595bfa0c8fd2159358394239cee4524429e9ed78b53c54314c374c089
4
- data.tar.gz: e9d5529b42236c24f415b544123ffed7dca080cff2d27877ee04a70e42fafee6
3
+ metadata.gz: 7e97ed28a1b00120dfcfc0c4650496dc1bb5417efaefa3e0f038f95f7f7fd55b
4
+ data.tar.gz: b4b59a6a0b6ad87c2c13e3d098c6864d31b46227a78e7597dc4ea4094c5bec29
5
5
  SHA512:
6
- metadata.gz: 00af8b7c41f06088f9dbd55b106884a74b3d76693c456b8532ed8fafbf5e2ea9861a0c624c8c1474dba4203122c3730736f7214ee58fab75a629ad977edfe843
7
- data.tar.gz: 40849817585017241be4928abbae027e1e8a5ae968a91eec4f7994b1e61ed0dc7f966da7c480809760d5e4e457db4a017fabed609c5d801c153cd6cb6e37dda1
6
+ metadata.gz: f427457f1582510097748cf5f980c13ca3e6e5c723a2b4268d3c77ade699f8b6ea596a9282fd653b97b40077bdf2011807a8869316710008f43855df58b99334
7
+ data.tar.gz: b6b09dc041ae29cf9f5cccd4846da30914a173d693158c731080e5519912e064d596b83340434d0412c634a365fd1097dd1420cbdd5e9a4ecc837d5b3939130e
@@ -52,8 +52,8 @@ module ActivePublisher
52
52
  end
53
53
 
54
54
  def cleanup_up_channel
55
- return if @channel.nil?
56
- @channel.close
55
+ return if channel.nil?
56
+ channel.close
57
57
  rescue => error
58
58
  ::ActivePublisher.configuration.error_handler.call(error, {:status => "Cleaning up the channel"})
59
59
  end
@@ -89,7 +89,6 @@ module ActivePublisher
89
89
 
90
90
  def start_thread
91
91
  return if alive?
92
- @channel = make_channel
93
92
  @thread = ::Thread.new { start_consuming_thread }
94
93
  end
95
94
 
@@ -102,13 +101,15 @@ module ActivePublisher
102
101
  # If the queue is empty, we should continue to update to "last_tick_at" time.
103
102
  next if current_messages.nil?
104
103
 
104
+ @channel ||= make_channel
105
+
105
106
  # We only look at active publisher messages. Everything else is dropped.
106
107
  current_messages.select! { |message| message.is_a?(::ActivePublisher::Message) }
107
108
 
108
109
  begin
109
110
  # Only open a single connection for each group of messages to an exchange
110
111
  current_messages.group_by(&:exchange_name).each do |exchange_name, messages|
111
- publish_all(@channel, exchange_name, messages)
112
+ publish_all(exchange_name, messages)
112
113
  current_messages -= messages
113
114
  end
114
115
  rescue *CHANNEL_CLOSED_ERRORS
@@ -135,7 +136,7 @@ module ActivePublisher
135
136
  cleanup_up_channel
136
137
  end
137
138
 
138
- def publish_all(channel, exchange_name, messages)
139
+ def publish_all(exchange_name, messages)
139
140
  exchange = channel.topic(exchange_name)
140
141
  messages.each do |message|
141
142
  fail ::ActivePublisher::ExchangeMismatchError, "bulk publish messages must match publish_all exchange_name" if message.exchange_name != exchange_name
@@ -144,10 +145,10 @@ module ActivePublisher
144
145
  exchange.publish(message.payload, options)
145
146
  end
146
147
  end
147
- wait_for_confirms(channel)
148
+ wait_for_confirms
148
149
  end
149
150
 
150
- def wait_for_confirms(channel)
151
+ def wait_for_confirms
151
152
  return true unless channel.using_publisher_confirms?
152
153
  channel.wait_for_confirms(::ActivePublisher.configuration.publisher_confirms_timeout)
153
154
  end
@@ -1,3 +1,3 @@
1
1
  module ActivePublisher
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Stien
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2020-11-20 00:00:00.000000000 Z
15
+ date: 2020-11-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bunny