hirefire-resource 0.7.1 → 0.7.2

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: 0bf414cb7e6529a04049ad3e7a7575a1932ec91fc8be57d8a2ce1ccc0922ab49
4
- data.tar.gz: 8c78e71660e89df170ca061a328bfaff3d19714d55bf3a8fac04a59fbd9f2569
3
+ metadata.gz: 14b05a951639660419ec0e420647752fef4b8e33ad615c0b4706cc70a9ceab87
4
+ data.tar.gz: 2567a0a3a2d287d220d80f085b835093b845989969484c4ed1a13460ef07ee2b
5
5
  SHA512:
6
- metadata.gz: 2f84e86124b9467d166a839b3c90fd979ac13ccb4f50005dfa0e61e77763191206714a569fe59ea991da41b287d3a165a4740ea49f603ecc65caebc2d924c654
7
- data.tar.gz: ce69dbda35b2762f727caa5e0d9fb5c76b3890ffa33cec9c20e46cc021d5b54f5842f337fc7264b00453dcf7074c3befd0db1970f89964ffb3703944d1837bb5
6
+ metadata.gz: 66fa48f86bf1377cb4ce1aa93e460621255a0f4802004d8ed3ba35ecb2fd59bfd86aa980589d9d6f4c6d69e5070195c7214c90858bb1f261dab799691e5ae643
7
+ data.tar.gz: ace370aec4f4e8c60d0caa521b996917a3eaee8598a5515219c00e07335a7b211dad9f962bf3b9ae0fb618520ec565c6fc0802a12243f1977d7719c83682f4f4
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "hirefire-resource"
5
- gem.version = "0.7.1"
5
+ gem.version = "0.7.2"
6
6
  gem.platform = Gem::Platform::RUBY
7
7
  gem.authors = "Michael van Rooijen"
8
8
  gem.email = "michael@hirefire.io"
@@ -4,14 +4,8 @@ module HireFire
4
4
  module Macro
5
5
  module Que
6
6
  QUERY = %{
7
- SELECT count(*) AS total,
8
- count(locks.job_id) AS running,
9
- coalesce(sum((error_count > 0 AND locks.job_id IS NULL)::int), 0) AS failing,
10
- coalesce(sum((error_count = 0 AND locks.job_id IS NULL)::int), 0) AS scheduled
11
- FROM que_jobs LEFT JOIN (
12
- SELECT (classid::bigint << 32) + objid::bigint AS job_id
13
- FROM pg_locks WHERE locktype = 'advisory'
14
- ) locks USING (job_id) }.freeze
7
+ SELECT count(*) AS total
8
+ FROM que_jobs WHERE run_at < now() }.freeze
15
9
 
16
10
  extend self
17
11
 
@@ -26,9 +20,9 @@ FROM que_jobs LEFT JOIN (
26
20
  # @return [Integer] the number of jobs in the queue(s).
27
21
  #
28
22
  def queue(queue = nil)
29
- query = queue ? "#{QUERY} WHERE queue = '#{queue}'" : QUERY
23
+ query = queue ? "#{QUERY} AND queue = '#{queue}'" : QUERY
30
24
  results = ::Que.execute(query).first
31
- results["total"].to_i - results["failing"].to_i
25
+ results["total"].to_i
32
26
  end
33
27
  end
34
28
  end
@@ -90,14 +90,10 @@ module HireFire
90
90
  # @return [String] in application/json format.
91
91
  #
92
92
  def build_info_response
93
- entry_builder = lambda do |config|
93
+ entries = HireFire::Resource.dynos.map do |config|
94
94
  %({"name":"#{config[:name]}","quantity":#{config[:quantity].call || "null"}})
95
95
  end
96
96
 
97
- entries = HireFire::Resource.dynos.inject([]) do |buffer, config|
98
- buffer << entry_builder.call(config)
99
- end
100
-
101
97
  status = 200
102
98
  headers = Hash.new
103
99
  headers["Content-Type"] = "application/json"
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.7.1
4
+ version: 0.7.2
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: 2018-11-22 00:00:00.000000000 Z
11
+ date: 2019-07-13 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
@@ -56,8 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubyforge_project:
60
- rubygems_version: 2.7.7
59
+ rubygems_version: 3.0.3
61
60
  signing_key:
62
61
  specification_version: 4
63
62
  summary: Autoscaling for your Heroku dynos