hirefire-resource 0.3.13 → 0.4.0

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: e559cc6a94baeaab8a7bd92857a83ee143855ec1
4
- data.tar.gz: 89fe5810f660258e4e55e9e691771e8173f87677
3
+ metadata.gz: eca03aa06b7cb5b597f9247abfb2094cd4ba5804
4
+ data.tar.gz: 52a6226f8766e9ea15fbeafcda513e6c948cfbd8
5
5
  SHA512:
6
- metadata.gz: 0f7a893ccb8cee4b17d84a521eccf078f7809ed533637537f89a41b3e1d95349c98cf40507d4d36ba0315f979162e6d0464f7ae063009fc994ae10bc1f2a0e0c
7
- data.tar.gz: c241f34e6b30853fd079979ddfd64128e0a59360e86323f1cb090cda37af00822e591495d8a13412fcb5b5ca56890b93cc27416595f93fabf5168f110d1d2638
6
+ metadata.gz: 900c29b7ad260db8510b831c76ff87dfcccc5fd8990fc0cca3f792f0b65a44532dbe11852cc60ab61b9f1a536e826159b36432ce5c7d0cda8a3640cf3a56d1c5
7
+ data.tar.gz: 2481e45b0c12da53f39e8c708e4258c2433d96318f52d6c489800402991d3ac552a4b9c2e268ed08124225aa769792de6177baa617e0649e2efe116d70385409
data/README.md CHANGED
@@ -12,6 +12,7 @@ It supports practically any worker library. We provide out-of-the-box support fo
12
12
  * QueueClassic
13
13
  * Sidekiq
14
14
  * Bunny
15
+ * Que
15
16
 
16
17
  *Note that you can write your own worker queue logic for almost any other worker library as well.
17
18
  HireFire can scale multiple individual worker libraries at the same time, as well as multiple individual queues for any worker library.*
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "hirefire-resource"
5
- gem.version = "0.3.13"
5
+ gem.version = "0.4.0"
6
6
  gem.platform = Gem::Platform::RUBY
7
7
  gem.authors = "Michael van Rooijen"
8
8
  gem.email = "michael@hirefire.io"
@@ -6,7 +6,7 @@ HIREFIRE_PATH = File.expand_path("../hirefire", __FILE__)
6
6
  require "#{HIREFIRE_PATH}/#{file}"
7
7
  end
8
8
 
9
- %w[delayed_job resque sidekiq qu qc bunny].each do |file|
9
+ %w[delayed_job resque sidekiq qu qc bunny que].each do |file|
10
10
  require "#{HIREFIRE_PATH}/macro/#{file}"
11
11
  end
12
12
 
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ module HireFire
4
+ module Macro
5
+ module Que
6
+ extend self
7
+
8
+ # Queries the PostgreSQL database through Que in order to
9
+ # count the amount of jobs in the specified queue.
10
+ #
11
+ # @example Queue Macro Usage
12
+ # HireFire::Macro::Que.queue # counts all queues.
13
+ # HireFire::Macro::Que.queue("email") # counts the `email` queue.
14
+ #
15
+ # @param [String] queue the queue name to count. (default: nil # gets all queues)
16
+ # @return [Integer] the number of jobs in the queue(s).
17
+ #
18
+ def queue(queue = nil)
19
+ query = ::Que::Web::SQL[:dashboard_stats]
20
+ query = "#{query} WHERE queue = '#{queue}'" if queue
21
+ results = ::Que.execute(query).first
22
+ results["total"].to_i - results["failing"].to_i
23
+ end
24
+ end
25
+ end
26
+ 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.13
4
+ version: 0.4.0
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: 2016-12-07 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Load- and schedule-based scaling for web- and worker dynos
14
14
  email: michael@hirefire.io
@@ -31,6 +31,7 @@ files:
31
31
  - lib/hirefire/macro/delayed_job.rb
32
32
  - lib/hirefire/macro/qc.rb
33
33
  - lib/hirefire/macro/qu.rb
34
+ - lib/hirefire/macro/que.rb
34
35
  - lib/hirefire/macro/resque.rb
35
36
  - lib/hirefire/macro/sidekiq.rb
36
37
  - lib/hirefire/middleware.rb
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
57
  version: '0'
57
58
  requirements: []
58
59
  rubyforge_project:
59
- rubygems_version: 2.5.2
60
+ rubygems_version: 2.6.8
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: Autoscaling for your Heroku dynos