hirefire-resource 0.3.5 → 0.3.6

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
  SHA1:
3
- metadata.gz: 9483a65248d4c218eebfbc663e16d6a5894b623c
4
- data.tar.gz: f1c5a0c7c206b04196d6a3974c6c59d59e92491a
3
+ metadata.gz: 7a837ad85215ea4c9fb9db5d9df59e9d2efb9682
4
+ data.tar.gz: 019bb5a936269518290899332c41fc1b4c831e5c
5
5
  SHA512:
6
- metadata.gz: c1c752cf3a8621dfdc24f10a86389bfc093b244743b41a8acac636c8e287051c39c9d244a8fda7770042f0a205acbdd9f582dd08ff883102faf8e9875015f035
7
- data.tar.gz: fdbefd6e8555f33fed3ab535d0f7294321ea84aa6c3ddd3da0920a12b76385f4682287ed3273f6a35c333cfe20f6c1ce4324cdb172b60fb00e2cf3431abeb0b0
6
+ metadata.gz: 8f79e026eea2e841a67faeec56bceb7acf835dd08f31100447782de70c7715505cda00437fed0a72d33ffe6917dc944e0e9f11bcc73f422b2d3232b57bc0de22
7
+ data.tar.gz: fc1cb09f2e55ec48999f0a3a4ac01eec489696c44241d7f03babf6afbf93a20bd76d6f94daf8a33f2f23f92fb5866dd97ae835730c2c9ac96acd57f7549b9f59
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "hirefire-resource"
5
- gem.version = "0.3.5"
5
+ gem.version = "0.3.6"
6
6
  gem.platform = Gem::Platform::RUBY
7
7
  gem.authors = "Michael van Rooijen"
8
8
  gem.email = "michael@hirefire.io"
@@ -19,13 +19,17 @@ module HireFire
19
19
  queues = queues.flatten.map(&:to_s)
20
20
  queues = ::Resque.queues if queues.empty?
21
21
 
22
- in_queues = queues.inject(0) do |memo, queue|
23
- memo += ::Resque.size(queue)
24
- memo
25
- end
22
+ redis = ::Resque.redis
23
+ ids = Array(redis.smembers(:workers)).compact
24
+ raw_jobs = redis.pipelined { ids.map { |id| redis.get("worker:#{id}") } }
25
+ jobs = raw_jobs.map { |raw_job| ::Resque.decode(raw_job) || {} }
26
26
 
27
- in_progress = ::Resque::Worker.all.inject(0) do |memo, worker|
28
- memo += 1 if queues.include?(worker.job["queue"])
27
+ in_queues = redis.pipelined do
28
+ queues.map { |queue| redis.llen("queue:#{queue}") }
29
+ end.map(&:to_i).inject(&:+)
30
+
31
+ in_progress = jobs.inject(0) do |memo, job|
32
+ memo += 1 if queues.include?(job["queue"])
29
33
  memo
30
34
  end
31
35
 
@@ -34,4 +38,3 @@ module HireFire
34
38
  end
35
39
  end
36
40
  end
37
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hirefire-resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van Rooijen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Load-based scaling, schedule-based scaling, dyno crash recovery, for
14
14
  web- and worker dynos.
@@ -61,4 +61,3 @@ signing_key:
61
61
  specification_version: 4
62
62
  summary: Autoscaling for your Heroku dynos
63
63
  test_files: []
64
- has_rdoc: