active_publisher 1.2.5-java → 1.2.6-java

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: 7a878924c71e32c34435e80052a8f241b357d2f7b70f3582f7b8920b942e63c0
4
- data.tar.gz: 60b4eb97d20e389ce4865ef393d69a7d49bdac2e47a3aa26eb6e7ca32e459335
3
+ metadata.gz: 5eb0ac3e4acd1a5a7cd668d9eef3bd900af1964781b65eb22c3b97d17add28b4
4
+ data.tar.gz: 8bb17f982325ef1d4923939f4e13729affddfc4320c793305837d9a368c51f22
5
5
  SHA512:
6
- metadata.gz: 8f6399701888401993164b31ccb4fff4f14eb13414a7586d7baacac0c49f2c876dfe33035ce091ec4b62ee4a5b64ad961a7deab79691098401388153404c724b
7
- data.tar.gz: 2a1d1347293457b9e5b663d7f4815a176e8d9afdc80e472893c4f1f5206bdfc057bfb6d692067924727aac1e3a6f42bc2fff20cd13698bca12be61e1b72d84bc
6
+ metadata.gz: 8ce688832579a6ac3eb94051b43b5fd956c10bf8c1e64b1a7354c806543674810a6784f18caab97165b0115cc52e9aa156732f04cd2be93bd69e36bf38eb9028
7
+ data.tar.gz: 0fd321640fe284276f11c5e262df01f9731e1ea9a870cddc22a85fee6753663ee315fc427c2d1aa0ecab29afc35c31e9cefbd14283db4491cb16fb11398ddf3e
@@ -2,7 +2,7 @@ module ActivePublisher
2
2
  module Async
3
3
  module InMemoryAdapter
4
4
  class ConsumerThread
5
- attr_reader :channel, :thread, :queue, :sampled_queue_size, :last_tick_at
5
+ attr_reader :channel, :flush_max, :thread, :queue, :sampled_queue_size, :last_tick_at
6
6
 
7
7
  if ::RUBY_PLATFORM == "java"
8
8
  CHANNEL_CLOSED_ERRORS = [::MarchHare::ChannelAlreadyClosed]
@@ -27,6 +27,7 @@ module ActivePublisher
27
27
  def initialize(listen_queue)
28
28
  @queue = listen_queue
29
29
  @sampled_queue_size = queue.size
30
+ @flush_max = ::ActivePublisher.configuration.messages_per_batch
30
31
 
31
32
  update_last_tick_at
32
33
  start_thread
@@ -96,7 +97,7 @@ module ActivePublisher
96
97
  loop do
97
98
  # Sample the queue size so we don't shutdown when messages are in flight.
98
99
  @sampled_queue_size = queue.size
99
- current_messages = queue.pop_up_to(50, :timeout => 0.1)
100
+ current_messages = queue.pop_up_to(flush_max, :timeout => 0.1)
100
101
  update_last_tick_at
101
102
  # If the queue is empty, we should continue to update to "last_tick_at" time.
102
103
  next if current_messages.nil?
@@ -19,7 +19,7 @@ module ActivePublisher
19
19
  }
20
20
  include ::ActivePublisher::Logging
21
21
 
22
- attr_reader :async_queue, :redis_pool, :queue
22
+ attr_reader :async_queue, :flush_max, :flush_min, :redis_pool, :queue
23
23
 
24
24
  def initialize(new_redis_pool)
25
25
  logger.info "Starting redis publisher adapter"
@@ -27,6 +27,8 @@ module ActivePublisher
27
27
  @redis_pool = new_redis_pool
28
28
  @async_queue = ::ActivePublisher::Async::RedisAdapter::Consumer.new(redis_pool)
29
29
  @queue = ::MultiOpQueue::Queue.new
30
+ @flush_max = ::ActivePublisher.configuration.messages_per_batch
31
+ @flush_min = @flush_max / 2
30
32
 
31
33
  supervisor_task = ::Concurrent::TimerTask.new(SUPERVISOR_INTERVAL) do
32
34
  queue_size = queue.size
@@ -41,7 +43,7 @@ module ActivePublisher
41
43
  def publish(route, payload, exchange_name, options = {})
42
44
  message = ::ActivePublisher::Message.new(route, payload, exchange_name, options)
43
45
  queue << ::Marshal.dump(message)
44
- flush_queue! if queue.size >= 20 || options[:flush_queue]
46
+ flush_queue! if queue.size >= flush_min || options[:flush_queue]
45
47
 
46
48
  nil
47
49
  end
@@ -58,7 +60,7 @@ module ActivePublisher
58
60
 
59
61
  def flush_queue!
60
62
  return if queue.empty?
61
- encoded_messages = queue.pop_up_to(25, :timeout => 0.001)
63
+ encoded_messages = queue.pop_up_to(flush_max, :timeout => 0.001)
62
64
 
63
65
  return if encoded_messages.nil?
64
66
  return unless encoded_messages.respond_to?(:each)
@@ -8,6 +8,7 @@ module ActivePublisher
8
8
  :host,
9
9
  :hosts,
10
10
  :max_async_publisher_lag_time,
11
+ :messages_per_batch,
11
12
  :network_recovery_interval,
12
13
  :password,
13
14
  :port,
@@ -36,6 +37,7 @@ module ActivePublisher
36
37
  :host => "localhost",
37
38
  :hosts => [],
38
39
  :password => "guest",
40
+ :messages_per_batch => 25,
39
41
  :max_async_publisher_lag_time => 10,
40
42
  :network_recovery_interval => NETWORK_RECOVERY_INTERVAL,
41
43
  :port => 5672,
@@ -1,3 +1,3 @@
1
1
  module ActivePublisher
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
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.5
4
+ version: 1.2.6
5
5
  platform: java
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-23 00:00:00.000000000 Z
15
+ date: 2021-09-29 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement
@@ -21,8 +21,8 @@ dependencies:
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.7'
23
23
  name: march_hare
24
- prerelease: false
25
24
  type: :runtime
25
+ prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - "~>"
@@ -35,8 +35,8 @@ dependencies:
35
35
  - !ruby/object:Gem::Version
36
36
  version: '3.2'
37
37
  name: activesupport
38
- prerelease: false
39
38
  type: :runtime
39
+ prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
42
  - - ">="
@@ -49,8 +49,8 @@ dependencies:
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  name: concurrent-ruby
52
- prerelease: false
53
52
  type: :runtime
53
+ prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - ">="
@@ -63,8 +63,8 @@ dependencies:
63
63
  - !ruby/object:Gem::Version
64
64
  version: 0.2.0
65
65
  name: multi_op_queue
66
- prerelease: false
67
66
  type: :runtime
67
+ prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - ">="
@@ -77,8 +77,8 @@ dependencies:
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  name: benchmark-ips
80
- prerelease: false
81
80
  type: :development
81
+ prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - ">="
@@ -91,8 +91,8 @@ dependencies:
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  name: bundler
94
- prerelease: false
95
94
  type: :development
95
+ prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - ">="
@@ -105,8 +105,8 @@ dependencies:
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  name: connection_pool
108
- prerelease: false
109
108
  type: :development
109
+ prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - ">="
@@ -119,8 +119,8 @@ dependencies:
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  name: fakeredis
122
- prerelease: false
123
122
  type: :development
123
+ prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - ">="
@@ -133,8 +133,8 @@ dependencies:
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  name: pry
136
- prerelease: false
137
136
  type: :development
137
+ prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - ">="
@@ -147,8 +147,8 @@ dependencies:
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  name: rake
150
- prerelease: false
151
150
  type: :development
151
+ prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - ">="
@@ -161,8 +161,8 @@ dependencies:
161
161
  - !ruby/object:Gem::Version
162
162
  version: '3.2'
163
163
  name: rspec
164
- prerelease: false
165
164
  type: :development
165
+ prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
167
167
  requirements:
168
168
  - - "~>"
@@ -223,8 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  - !ruby/object:Gem::Version
224
224
  version: '0'
225
225
  requirements: []
226
- rubyforge_project:
227
- rubygems_version: 2.7.9
226
+ rubygems_version: 3.0.6
228
227
  signing_key:
229
228
  specification_version: 4
230
229
  summary: Aims to make publishing work across MRI and jRuby painless and add some nice