que-view 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 062e48206fe33c45a7f007d831b31a5c4566d6eb4af6891cfad6949108f45b56
4
- data.tar.gz: c3c2fd233567554fc46e7296a9895d7e8c7b650789fcb1fb7f49d2d023cc3670
3
+ metadata.gz: fcbc566936eae22f23cba44ed6908437fba07dbf621128895f4fe4e40319ad61
4
+ data.tar.gz: a7f2213f756286321699a96f10e1b69c1578e91dff46daa877c37db41898efde
5
5
  SHA512:
6
- metadata.gz: 3a4b0f0e2bac21033c9e3db5a8ea193b599679e88abb064f7a07b71608893e861e192196d2b688f70c8f9cf5c092d48b40925bfa190d1760172965ac8c319149
7
- data.tar.gz: 3db157d3fb95fa530c43607ac9c7924b9ca84cbc305f134ae08635048d77c0213e71401770e4e8c30bbffbfc414c4f233d17bd5896ce2b661b12d464f1914c93
6
+ metadata.gz: 6250a8886b4d258f080d4133caddff6292295d4a586dadf5b678fbb98052e59a78ec2de42eaa928dc6def2de8a2a0800e086528c150111f1b80c171405eac0de
7
+ data.tar.gz: 4a41eff359089fd195b47408a64f0fa94805c1230fbf40d3cbf2001f76e8e465040d78f79f8186411c4fa46a90d979b21b3bae3796c5524f6f98833844be24c3
@@ -19,7 +19,7 @@ module Que
19
19
  @queue_latencies =
20
20
  ::Que::View
21
21
  .fetch_queue_latencies(@queue_metrics.keys)
22
- .transform_values { |value| current_time - value.to_time.to_i }
22
+ .transform_values { |value| value ? (current_time - value.to_time.to_i) : 0 }
23
23
  end
24
24
  end
25
25
  end
data/lib/que/view/dsl.rb CHANGED
@@ -94,7 +94,7 @@ module Que
94
94
  <<-SQL.squish
95
95
  SELECT count(*) AS total,
96
96
  count(locks.job_id) AS running,
97
- coalesce(sum((error_count > 0 AND locks.job_id IS NULL)::int), 0) AS failing,
97
+ coalesce(sum((error_count > 0 AND locks.job_id IS NULL AND expired_at IS NULL)::int), 0) AS failing,
98
98
  coalesce(sum((error_count = 0 AND locks.job_id IS NULL)::int), 0) AS scheduled,
99
99
  coalesce(sum((finished_at IS NOT NULL)::int), 0) AS finished,
100
100
  coalesce(sum((expired_at IS NOT NULL)::int), 0) AS expired
@@ -120,7 +120,7 @@ module Que
120
120
  CASE
121
121
  WHEN expired_at IS NOT NULL THEN 'expired'
122
122
  WHEN finished_at IS NOT NULL THEN 'finished'
123
- WHEN locks.job_id IS NULL AND error_count > 0 THEN 'failing'
123
+ WHEN locks.job_id IS NULL AND error_count > 0 AND expired_at IS NULL THEN 'failing'
124
124
  WHEN locks.job_id IS NULL AND error_count = 0 THEN 'scheduled'
125
125
  ELSE 'running'
126
126
  END status
@@ -134,7 +134,7 @@ module Que
134
134
  CASE
135
135
  WHEN expired_at IS NOT NULL THEN 'expired'
136
136
  WHEN finished_at IS NOT NULL THEN 'finished'
137
- WHEN locks.job_id IS NULL AND error_count > 0 THEN 'failing'
137
+ WHEN locks.job_id IS NULL AND error_count > 0 AND expired_at IS NULL THEN 'failing'
138
138
  WHEN locks.job_id IS NULL AND error_count = 0 THEN 'scheduled'
139
139
  ELSE 'running'
140
140
  END
@@ -174,6 +174,7 @@ module Que
174
174
  where_condition = <<-SQL.squish
175
175
  WHERE locks.job_id IS NULL
176
176
  AND error_count > 0
177
+ AND expired_at IS NULL
177
178
  #{search_condition(params)}
178
179
  SQL
179
180
  fetch_jobs_sql(per_page, offset, where_condition)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Que
4
4
  module View
5
- VERSION = '0.3.3'
5
+ VERSION = '0.3.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: que-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdanov Anton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-06 00:00:00.000000000 Z
11
+ date: 2024-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: que