active_publisher 1.2.0.pre5-java → 1.2.0.pre6-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: 40de0cc1b0adca96b23de5ddb5fb5fc79738644e74a8dc5a40990ec3b67a56ed
4
- data.tar.gz: 61ae6ef5ae471f9a9c6dce0156e45e7bf51f09b64b7e5ae1cd8a1762b08eb829
3
+ metadata.gz: 11d1b9773427c5ae05fa5d590f83f270141ca1b8ccc4811fb163be87c98a80af
4
+ data.tar.gz: c1f2f8231212d9d3ccb7a6a8d2cc4e5b2786637915d7e0b2447598f114085af0
5
5
  SHA512:
6
- metadata.gz: 3aabc8bb12969dce2a4e176a6420acfc1cdcd70c47e361f7dd665879e5445e93ba6777cdc6a6f523baea4c116c70040a3cde6fd21b565424f68426fb2c4a04f1
7
- data.tar.gz: ed43c8134e853a0a2b8b0d904361c51f6d73120f991b26e5adedc46df454407da5f0ac8317596dc0dfea380f6fc3c5ef1a9c88cb70e011855a61f45ee99b0637
6
+ metadata.gz: 54d67ce2651ec0e6d3db5c84e11af82a71f4a2a5c0410b9991c846d4263527ec5479be7044573c2f605cca31edf8b512ec557e7cd5a5865fca8aafb884b1f5b3
7
+ data.tar.gz: d598c499b8e78152c9f5b50ffe97cbda35b201c7523635f441480ea88e175d503804d522e87c5750024ccbbdec6fbf8413640607c7da74d38f28178b0cbbd02c
@@ -65,7 +65,7 @@ module ActivePublisher
65
65
  return unless encoded_messages.size > 0
66
66
 
67
67
  redis_pool.with do |redis|
68
- redis.lpush(::ActivePublisher::Async::RedisAdapter::REDIS_LIST_KEY, encoded_messages)
68
+ redis.rpush(::ActivePublisher::Async::RedisAdapter::REDIS_LIST_KEY, encoded_messages)
69
69
  end
70
70
  end
71
71
  end
@@ -13,7 +13,7 @@ module ActivePublisher
13
13
  encoded_message = ::Marshal.dump(message)
14
14
 
15
15
  redis_pool.with do |redis|
16
- redis.lpush(list_key, encoded_message)
16
+ redis.rpush(list_key, encoded_message)
17
17
  end
18
18
  end
19
19
 
@@ -28,7 +28,7 @@ module ActivePublisher
28
28
  end
29
29
 
30
30
  redis_pool.with do |redis|
31
- redis.lpush(list_key, encoded_messages)
31
+ redis.rpush(list_key, encoded_messages)
32
32
  end
33
33
  end
34
34
 
@@ -71,25 +71,30 @@ module ActivePublisher
71
71
  end
72
72
 
73
73
  def shift(number)
74
- messages = []
75
74
  number = [number, size].min
75
+ return [] if number <= 0
76
+
77
+ messages = []
78
+ multi_response = []
76
79
  redis_pool.with do |redis|
77
- redis.pipelined do
78
- number.times do
79
- messages << redis.rpop(list_key)
80
- end
80
+ multi_response = redis.multi do
81
+ redis.lrange(list_key, 0, number - 1)
82
+ redis.ltrim(list_key, number, -1)
81
83
  end
82
84
  end
83
85
 
86
+ messages = multi_response.first
87
+ success = multi_response.last
88
+ return [] unless success =~ /ok/i
89
+
84
90
  messages = [] if messages.nil?
85
91
  messages = [messages] unless messages.respond_to?(:each)
86
92
 
87
93
  shifted_messages = []
88
94
  messages.each do |message|
89
- next unless message.is_a?(::Redis::Future)
90
- next if message.value.nil?
95
+ next if message.nil?
91
96
 
92
- shifted_messages << ::Marshal.load(message.value)
97
+ shifted_messages << ::Marshal.load(message)
93
98
  end
94
99
 
95
100
  shifted_messages
@@ -1,3 +1,3 @@
1
1
  module ActivePublisher
2
- VERSION = "1.2.0.pre5"
2
+ VERSION = "1.2.0.pre6"
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.0.pre5
4
+ version: 1.2.0.pre6
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: 2018-01-23 00:00:00.000000000 Z
15
+ date: 2018-01-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement