allq 0.3.96 → 0.3.97

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: 2ff141b1a2c2210da9858adf999abbe98c9324aac650fe8cad853324197e41f9
4
- data.tar.gz: 529b99a45e9a8d42b27b3b77a10e73697ea4de471cef3c3b25e8a67dc014d558
3
+ metadata.gz: a351bb1230f22a40648a9bf66b8af145b9fc74c53369c0b49e0b3350b6d814d0
4
+ data.tar.gz: cb948273e6f519bae6e0b570a6a19320cbd12376046d36df9132d98a6fa22b02
5
5
  SHA512:
6
- metadata.gz: 9568d8653d4df2c966d585025f45b18837020326360dfd71714a44a0a7486ac780164b3f2afb1c330baa3932f7dadb6aee048c3a22b148be0d5dc849e6227fd0
7
- data.tar.gz: 60a515a9919c067b5fe7891823e71bf97dc2a506613a8d9f1be9f46e94fecdd57e73432595f3e9e05f97400f4109d58db77317b25608322c10300857b910d3c3
6
+ metadata.gz: 7fc90d01ca186cf956db67604ebd4f3098a942039ea169b33c7a9b40b0ead6fcce49693a427097c0089f43dead4f1362a13cce4e792b5deed557b1e3180c16e9
7
+ data.tar.gz: 557cea72228b3947a5b9fcfbc90f74c6c45638722e13a7f135ef9bdbc6de3ef318a66f647054f18170bf1741d4378f6900c59f41ebfc43db4dbe3ea4780dd001
@@ -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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Allq
2
- VERSION = "0.3.96"
2
+ VERSION = "0.3.97"
3
3
  end
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.96
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-09-04 00:00:00.000000000 Z
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