allq 0.3.96 → 0.3.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/allq.rb +1 -1
- data/lib/allq/actions/throttle.rb +24 -0
- data/lib/allq/client.rb +6 -0
- data/lib/allq/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a351bb1230f22a40648a9bf66b8af145b9fc74c53369c0b49e0b3350b6d814d0
|
4
|
+
data.tar.gz: cb948273e6f519bae6e0b570a6a19320cbd12376046d36df9132d98a6fa22b02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fc90d01ca186cf956db67604ebd4f3098a942039ea169b33c7a9b40b0ead6fcce49693a427097c0089f43dead4f1362a13cce4e792b5deed557b1e3180c16e9
|
7
|
+
data.tar.gz: 557cea72228b3947a5b9fcfbc90f74c6c45638722e13a7f135ef9bdbc6de3ef318a66f647054f18170bf1741d4378f6900c59f41ebfc43db4dbe3ea4780dd001
|
data/lib/allq.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative "allq/#{f}"
|
4
4
|
end
|
5
5
|
|
6
|
-
%w(base get delete done put release stats touch kick peek clear bury parent_job drain add_server).each do |f|
|
6
|
+
%w(base get delete done put release stats touch kick peek clear bury parent_job drain add_server throttle).each do |f|
|
7
7
|
require_relative "allq/actions/#{f}"
|
8
8
|
end
|
9
9
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class AllQ
|
2
|
+
class Throttle < AllQ::Base
|
3
|
+
|
4
|
+
def snd(data)
|
5
|
+
name = data[:name]
|
6
|
+
tps = data[:tps].to_i || 10
|
7
|
+
|
8
|
+
send_data = base_send(name, tps)
|
9
|
+
response = send_hash_as_json(send_data, true)
|
10
|
+
rcv(response)
|
11
|
+
end
|
12
|
+
|
13
|
+
def base_send(name, tps)
|
14
|
+
{
|
15
|
+
'action' => 'throttle',
|
16
|
+
'params' => {
|
17
|
+
'tube' => name,
|
18
|
+
'tps' => tps
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/allq/client.rb
CHANGED
@@ -91,9 +91,14 @@ class AllQ
|
|
91
91
|
|
92
92
|
def release(job, delay)
|
93
93
|
raise "Can't 'release' a Job that is nil." unless job
|
94
|
+
raise "Delay must be a int" unless delay.is_a?(Integer)
|
94
95
|
@release_action.snd(job_id: job.id, delay: delay)
|
95
96
|
end
|
96
97
|
|
98
|
+
def throttle(tube, tps)
|
99
|
+
@throttle_action.snd(name: tube, tps: tps)
|
100
|
+
end
|
101
|
+
|
97
102
|
def close
|
98
103
|
@connection.close
|
99
104
|
end
|
@@ -116,6 +121,7 @@ class AllQ
|
|
116
121
|
@peek_action = AllQ::Peek.new(@connection, self)
|
117
122
|
@delete_action = AllQ::Delete.new(@connection, self)
|
118
123
|
@parent_job_action = AllQ::ParentJob.new(@connection, self)
|
124
|
+
@throttle_action = AllQ::Throttle.new(@connection, self)
|
119
125
|
end
|
120
126
|
|
121
127
|
|
data/lib/allq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.97
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/allq/actions/put.rb
|
86
86
|
- lib/allq/actions/release.rb
|
87
87
|
- lib/allq/actions/stats.rb
|
88
|
+
- lib/allq/actions/throttle.rb
|
88
89
|
- lib/allq/actions/touch.rb
|
89
90
|
- lib/allq/client.rb
|
90
91
|
- lib/allq/connection.rb
|