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 +4 -4
- data/hirefire-resource.gemspec +1 -1
- data/lib/hirefire/macro/que.rb +4 -10
- data/lib/hirefire/middleware.rb +1 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14b05a951639660419ec0e420647752fef4b8e33ad615c0b4706cc70a9ceab87
|
4
|
+
data.tar.gz: 2567a0a3a2d287d220d80f085b835093b845989969484c4ed1a13460ef07ee2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66fa48f86bf1377cb4ce1aa93e460621255a0f4802004d8ed3ba35ecb2fd59bfd86aa980589d9d6f4c6d69e5070195c7214c90858bb1f261dab799691e5ae643
|
7
|
+
data.tar.gz: ace370aec4f4e8c60d0caa521b996917a3eaee8598a5515219c00e07335a7b211dad9f962bf3b9ae0fb618520ec565c6fc0802a12243f1977d7719c83682f4f4
|
data/hirefire-resource.gemspec
CHANGED
data/lib/hirefire/macro/que.rb
CHANGED
@@ -4,14 +4,8 @@ module HireFire
|
|
4
4
|
module Macro
|
5
5
|
module Que
|
6
6
|
QUERY = %{
|
7
|
-
SELECT count(*)
|
8
|
-
|
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}
|
23
|
+
query = queue ? "#{QUERY} AND queue = '#{queue}'" : QUERY
|
30
24
|
results = ::Que.execute(query).first
|
31
|
-
results["total"].to_i
|
25
|
+
results["total"].to_i
|
32
26
|
end
|
33
27
|
end
|
34
28
|
end
|
data/lib/hirefire/middleware.rb
CHANGED
@@ -90,14 +90,10 @@ module HireFire
|
|
90
90
|
# @return [String] in application/json format.
|
91
91
|
#
|
92
92
|
def build_info_response
|
93
|
-
|
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.
|
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:
|
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
|
-
|
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
|