hirefire-resource 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hirefire-resource.gemspec +1 -1
- data/lib/hirefire/macro/sidekiq.rb +22 -8
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55b749a5f42d84e6bab55c403be81132b083753f
|
4
|
+
data.tar.gz: 60e1543b6a620b45cc4dc25e38ca07c671db7695
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e6009e98f7debbda254a5632e5111127bd0f7fa56b59414c024e2cf9ebe1437925a9af14c2e4634dec0aa0d85b6412bd2ffa3d9b3a36b0a4c594566c9ac4e32
|
7
|
+
data.tar.gz: b2cd03832e203d95728ef05055f074c3056758da9bfd8bac0d89dd5d623df7a15aa5682b3fa3ae797e849ab8f01c918018457b68526c19e44d565168ff9a3bd8
|
data/hirefire-resource.gemspec
CHANGED
@@ -11,6 +11,8 @@ module HireFire
|
|
11
11
|
# HireFire::Macro::Sidekiq.queue # all queues
|
12
12
|
# HireFire::Macro::Sidekiq.queue("email") # only email queue
|
13
13
|
# HireFire::Macro::Sidekiq.queue("audio", "video") # audio and video queues
|
14
|
+
# HireFire::Macro::Sidekiq.queue("email", skip_scheduled: true) # only email, will not count scheduled queue
|
15
|
+
# HireFire::Macro::Sidekiq.queue("audio", skip_retries: true) # only audio, will not count the retries queue
|
14
16
|
#
|
15
17
|
# @param [Array] queues provide one or more queue names, or none for "all".
|
16
18
|
# @return [Integer] the number of jobs in the queue(s).
|
@@ -18,7 +20,15 @@ module HireFire
|
|
18
20
|
def queue(*queues)
|
19
21
|
require "sidekiq/api"
|
20
22
|
|
21
|
-
queues
|
23
|
+
queues.flatten!
|
24
|
+
|
25
|
+
if queues.last.is_a?(Hash)
|
26
|
+
options = queues.pop
|
27
|
+
else
|
28
|
+
options = {}
|
29
|
+
end
|
30
|
+
|
31
|
+
queues = queues.map(&:to_s)
|
22
32
|
queues = ::Sidekiq::Stats.new.queues.map { |name, _| name } if queues.empty?
|
23
33
|
|
24
34
|
in_queues = queues.inject(0) do |memo, name|
|
@@ -26,14 +36,18 @@ module HireFire
|
|
26
36
|
memo
|
27
37
|
end
|
28
38
|
|
29
|
-
|
30
|
-
|
31
|
-
|
39
|
+
if !options[:skip_scheduled]
|
40
|
+
in_schedule = ::Sidekiq::ScheduledSet.new.inject(0) do |memo, job|
|
41
|
+
memo += 1 if queues.include?(job["queue"]) && job.at <= Time.now
|
42
|
+
memo
|
43
|
+
end
|
32
44
|
end
|
33
45
|
|
34
|
-
|
35
|
-
|
36
|
-
|
46
|
+
if !options[:skip_retries]
|
47
|
+
in_retry = ::Sidekiq::RetrySet.new.inject(0) do |memo, job|
|
48
|
+
memo += 1 if queues.include?(job["queue"]) && job.at <= Time.now
|
49
|
+
memo
|
50
|
+
end
|
37
51
|
end
|
38
52
|
|
39
53
|
i = ::Sidekiq::VERSION >= "3.0.0" ? 2 : 1
|
@@ -42,7 +56,7 @@ module HireFire
|
|
42
56
|
memo
|
43
57
|
end
|
44
58
|
|
45
|
-
in_queues
|
59
|
+
[in_queues, in_schedule, in_retry, in_progress].compact.inject(&:+)
|
46
60
|
end
|
47
61
|
end
|
48
62
|
end
|
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.
|
4
|
+
version: 0.3.9
|
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:
|
11
|
+
date: 2016-01-12 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.
|
@@ -57,8 +57,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
version: '0'
|
58
58
|
requirements: []
|
59
59
|
rubyforge_project:
|
60
|
-
rubygems_version: 2.4.5
|
60
|
+
rubygems_version: 2.4.5.1
|
61
61
|
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: Autoscaling for your Heroku dynos
|
64
64
|
test_files: []
|
65
|
+
has_rdoc:
|