asynchronic 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/lib/asynchronic/queue_engine/ost.rb +11 -6
- data/lib/asynchronic/version.rb +1 -1
- data/spec/queue_engine/ost_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e125dac6480974894d48275d0015bb85410a9f4
|
4
|
+
data.tar.gz: 07b4801fd659a5c0735ccac5dc24c5340363afa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68006d635184823ac8bcdc4669690b4778b295b4eb98c5b8b4375c0284be30db220ee87bf3f6f7fc932365adb26a3196116b6549ef3432fa2391ec1395f7363
|
7
|
+
data.tar.gz: 630f880110f71041ab2bc18f5ad5258298b8f3d18560315569aa18ed8459986af20c3768cc3dc77992c82db3d2dce496125ad4931902cddd6ad11d4aaa8fe09e
|
data/.travis.yml
CHANGED
@@ -2,12 +2,12 @@ module Asynchronic
|
|
2
2
|
module QueueEngine
|
3
3
|
class Ost
|
4
4
|
|
5
|
-
attr_reader :default_queue
|
5
|
+
attr_reader :redis, :default_queue
|
6
6
|
|
7
7
|
def initialize(options={})
|
8
8
|
@redis = Redic.new(*Array(options[:redis]))
|
9
9
|
@default_queue = options.fetch(:default_queue, Asynchronic.default_queue)
|
10
|
-
@queues ||= Hash.new { |h,k| h[k] = Queue.new k }
|
10
|
+
@queues ||= Hash.new { |h,k| h[k] = Queue.new k, redis }
|
11
11
|
@keep_alive_thread = notify_keep_alive
|
12
12
|
end
|
13
13
|
|
@@ -16,12 +16,12 @@ module Asynchronic
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def queues
|
19
|
-
(@queues.values.map(&:key) |
|
19
|
+
(@queues.values.map(&:key) | redis.call('KEYS', 'ost:*')).map { |q| q.to_s[4..-1].to_sym }
|
20
20
|
end
|
21
21
|
|
22
22
|
def clear
|
23
23
|
@queues.clear
|
24
|
-
|
24
|
+
redis.call('KEYS', 'ost:*').each { |k| redis.call('DEL', k) }
|
25
25
|
end
|
26
26
|
|
27
27
|
def listener
|
@@ -33,7 +33,7 @@ module Asynchronic
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def active_connections
|
36
|
-
|
36
|
+
redis.call('CLIENT', 'LIST').split("\n").map do |connection_info|
|
37
37
|
connection_info.split(' ').detect { |a| a.match(/name=/) }[5..-1]
|
38
38
|
end.uniq.reject(&:empty?)
|
39
39
|
end
|
@@ -43,7 +43,7 @@ module Asynchronic
|
|
43
43
|
def notify_keep_alive
|
44
44
|
Thread.new do
|
45
45
|
loop do
|
46
|
-
|
46
|
+
redis.call 'CLIENT', 'SETNAME', Asynchronic.connection_name
|
47
47
|
sleep Asynchronic.keep_alive_timeout
|
48
48
|
end
|
49
49
|
end
|
@@ -52,6 +52,11 @@ module Asynchronic
|
|
52
52
|
|
53
53
|
class Queue < ::Ost::Queue
|
54
54
|
|
55
|
+
def initialize(name, redis)
|
56
|
+
super name
|
57
|
+
self.redis = redis
|
58
|
+
end
|
59
|
+
|
55
60
|
def pop
|
56
61
|
redis.call 'RPOP', key
|
57
62
|
end
|
data/lib/asynchronic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asynchronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ost
|