hirefire-resource 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f621ed62181e643001c9e2057a8d32eb46112c3
4
+ data.tar.gz: 9bf471379b5dcab6e181db0b0d176ecffcfd7248
5
+ SHA512:
6
+ metadata.gz: ff6b0804b37d7383bd960e8e7e6d44b49609b2268d07aa021fe40f9c2205e6897f8757eaa323eb3c617dde66e1803ae0aa742c1d1372587e988047d52f92964e
7
+ data.tar.gz: 31189235aa84bd54f2004abf3d58dc48bdc6c0d25f4bedc1432a6ebccf27335f709cb65f983f271ce259977c80c454cd9475bd96b395448340158c095d60fddd
data/README.md CHANGED
@@ -1,7 +1,4 @@
1
- # [HireFire](http://hirefireapp.com/) - The Heroku Dyno Manager
2
-
3
- *Note: This gem currently only applies to users that are using the [new HireFire beta](https://manager.hirefireapp.com/) program.
4
- Once out of beta, this will become the default gem for new users.*
1
+ # [HireFire](http://hirefire.io/) - The Heroku Dyno Manager
5
2
 
6
3
  HireFire is a hosted service that manages / autoscales your [Heroku](http://heroku.com/) dynos.
7
4
 
@@ -77,5 +74,5 @@ dj_worker: QUEUES=encode,compress bundle exec rake jobs:work
77
74
 
78
75
  Now that HireFire will scale both of the these dyno types based on their individual queue sizes. To customize how they scale, log in to the HireFire web interface.
79
76
 
80
- Visit the [official website](http://hirefireapp.com/) for more information!
77
+ Visit the [official website](http://hirefire.io/) for more information!
81
78
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "hirefire-resource"
5
- gem.version = "0.0.2"
5
+ gem.version = "0.1.0"
6
6
  gem.platform = Gem::Platform::RUBY
7
7
  gem.authors = "Michael van Rooijen"
8
- gem.email = "michael@hirefireapp.com"
9
- gem.homepage = "http://hirefireapp.com/"
8
+ gem.email = "michael@hirefire.io"
9
+ gem.homepage = "http://hirefire.io/"
10
10
  gem.summary = "HireFire - The Heroku Dyno Manager"
11
11
  gem.description = "HireFire - The Heroku Dyno Manager"
12
12
 
@@ -16,9 +16,20 @@ module HireFire
16
16
  #
17
17
  # @return [Integer] the number of jobs in the queue(s).
18
18
  def queue(*queues)
19
- return ::Resque.info[:pending].to_i if queues.empty?
20
19
  queues = queues.flatten.map(&:to_s)
21
- queues.inject(0) { |memo, queue| memo += ::Resque.size(queue); memo }
20
+ queues = ::Resque.queues if queues.empty?
21
+
22
+ in_queues = queues.inject(0) do |memo, queue|
23
+ memo += ::Resque.size(queue)
24
+ memo
25
+ end
26
+
27
+ in_progress = ::Resque::Worker.all.inject(0) do |memo, worker|
28
+ memo += 1 if queues.include?(worker.job["queue"])
29
+ memo
30
+ end
31
+
32
+ in_queues + in_progress
22
33
  end
23
34
  end
24
35
  end
@@ -16,13 +16,20 @@ module HireFire
16
16
  #
17
17
  # @return [Integer] the number of jobs in the queue(s).
18
18
  def queue(*queues)
19
- queues = ::Sidekiq.redis { |conn| conn.smembers("queues") } if queues.empty?
20
- queues.
21
- flatten.
22
- inject(0) { |memo, queue|
23
- memo += ::Sidekiq.redis { |conn| conn.llen("queue:#{queue}") }
24
- memo
25
- }
19
+ queues = queues.flatten.map(&:to_s)
20
+ queues = ::Sidekiq::Stats.new.queues.map { |name, _| name } if queues.empty?
21
+
22
+ in_queues = queues.inject(0) do |memo, name|
23
+ memo += ::Sidekiq::Queue.new(name).size
24
+ memo
25
+ end
26
+
27
+ in_progress = ::Sidekiq::Workers.new.inject(0) do |memo, job|
28
+ memo += 1 if queues.include?(job[1]["queue"]) && job[1]["run_at"] <= Time.now.to_i
29
+ memo
30
+ end
31
+
32
+ in_queues + in_progress
26
33
  end
27
34
  end
28
35
  end
metadata CHANGED
@@ -1,33 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hirefire-resource
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 2
9
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Michael van Rooijen
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2012-11-14 00:00:00 +01:00
18
- default_executable:
11
+ date: 2013-05-01 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
13
  description: HireFire - The Heroku Dyno Manager
22
- email: michael@hirefireapp.com
23
- executables:
14
+ email: michael@hirefire.io
15
+ executables:
24
16
  - hirefire
25
17
  - hirefireapp
26
18
  extensions: []
27
-
28
19
  extra_rdoc_files: []
29
-
30
- files:
20
+ files:
31
21
  - .gitignore
32
22
  - README.md
33
23
  - bin/hirefire
@@ -43,35 +33,28 @@ files:
43
33
  - lib/hirefire/middleware.rb
44
34
  - lib/hirefire/railtie.rb
45
35
  - lib/hirefire/resource.rb
46
- has_rdoc: true
47
- homepage: http://hirefireapp.com/
36
+ homepage: http://hirefire.io/
48
37
  licenses: []
49
-
38
+ metadata: {}
50
39
  post_install_message:
51
40
  rdoc_options: []
52
-
53
- require_paths:
41
+ require_paths:
54
42
  - lib
55
- required_ruby_version: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- segments:
60
- - 0
61
- version: "0"
62
- required_rubygems_version: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
- version: "0"
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
69
53
  requirements: []
70
-
71
54
  rubyforge_project:
72
- rubygems_version: 1.3.6
55
+ rubygems_version: 2.0.0
73
56
  signing_key:
74
- specification_version: 3
57
+ specification_version: 4
75
58
  summary: HireFire - The Heroku Dyno Manager
76
59
  test_files: []
77
-
60
+ has_rdoc: