hirefire-resource 1.0.7 → 1.0.8

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: 2472f4d981a95c1869a29eaa7b97429aa2f9f5d8e2a4e1858a167bfc916daee4
4
- data.tar.gz: c97478c3f7632dc6ea0c514d6f34894ea0514a1f259c9685e62ed3a63bbba6af
3
+ metadata.gz: 6ff7b6e9b3b7208480e0d3374e9aceba0c22ced18582d04e9aa4fda185df1753
4
+ data.tar.gz: 4528ab8e1528521c07e7d7a53f3d40d42a0a6de05d0b61c6e7f390ca03ed10b0
5
5
  SHA512:
6
- metadata.gz: 2dc43ce87ea0435294d7f86d44a5e99a30e1a913d170fafadcd7292d061c9a8acdc3a9e3646467d789d32aa83becc40ee89a2b2048136e1badf993f4f9e3e25f
7
- data.tar.gz: 90e56a5fdddeb1fdb98f891614fdb6cd66b7a6d07c6efd000ced14cb73de9aa44682d4772b6c4c12c1e114271b57600c7f578cb2a9439d79386d42fa2080d1e4
6
+ metadata.gz: 9cf97173b237ab2bc6ee5810a96fef55e0144331ccad0f750ae9e8edfcc7ef2715507e64bd1a4ae2019eb566ea7c8bb2fdba50cc6146f52824ed02e3212429b3
7
+ data.tar.gz: 2befdcc2d1a2fd0b3fc664ddff1417e47ebfef5f4e64241c031511fc30c85061e8272395b8eca58e482ff0b0844a816e99242e21191d450347adcf3406128fea
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v1.0.8
2
+
3
+ * Fix issue with range notation in ActiveRecord queries for old Rails versions that caused Delayed Job and Good Job macros to always return 0.
4
+
1
5
  ## v1.0.7
2
6
 
3
7
  * Add support for Sidekiq 8.
@@ -27,20 +27,15 @@ module HireFire
27
27
  # HireFire::Macro::Delayed::Job.job_queue_latency(:default, :mailer)
28
28
  def job_queue_latency(*queues)
29
29
  queues = normalize_queues(queues, allow_empty: true)
30
+ query = ::Delayed::Job.where(failed_at: nil).order(run_at: :asc)
30
31
 
31
- query =
32
- ::Delayed::Job
33
- .where(run_at: ..Time.now)
34
- .where(failed_at: nil)
35
- .order(run_at: :asc)
36
-
37
- if queues.any?
38
- case mapper
39
- when :active_record
40
- query = query.where(queue: queues)
41
- when :mongoid
42
- query = query.in(queue: queues.to_a)
43
- end
32
+ case mapper
33
+ when :active_record
34
+ query = query.where("run_at <= ?", Time.now)
35
+ query = query.where(queue: queues) if queues.any?
36
+ when :mongoid
37
+ query = query.where(run_at: {"$lte" => Time.now})
38
+ query = query.in(queue: queues.to_a) if queues.any?
44
39
  end
45
40
 
46
41
  if (job = query.first)
@@ -65,19 +60,15 @@ module HireFire
65
60
  # HireFire::Macro::Delayed::Job.job_queue_size(:default, :mailer)
66
61
  def job_queue_size(*queues)
67
62
  queues = normalize_queues(queues, allow_empty: true)
63
+ query = ::Delayed::Job.where(failed_at: nil)
68
64
 
69
- query =
70
- ::Delayed::Job
71
- .where(run_at: ..Time.now)
72
- .where(failed_at: nil)
73
-
74
- if queues.any?
75
- case mapper
76
- when :active_record
77
- query = query.where(queue: queues)
78
- when :mongoid
79
- query = query.in(queue: queues.to_a)
80
- end
65
+ case mapper
66
+ when :active_record
67
+ query = query.where("run_at <= ?", Time.now)
68
+ query = query.where(queue: queues) if queues.any?
69
+ when :mongoid
70
+ query = query.where(run_at: {"$lte" => Time.now})
71
+ query = query.in(queue: queues.to_a) if queues.any?
81
72
  end
82
73
 
83
74
  query.count
@@ -33,9 +33,9 @@ module HireFire
33
33
 
34
34
  case options[:mapper]
35
35
  when :active_record
36
- query = ::Delayed::Job.where(failed_at: nil, run_at: ..Time.now.utc)
37
- query = query.where(priority: options[:min_priority]..) if options.key?(:min_priority)
38
- query = query.where(priority: ..options[:max_priority]) if options.key?(:max_priority)
36
+ query = ::Delayed::Job.where(failed_at: nil).where("run_at <= ?", Time.now.utc)
37
+ query = query.where("priority >= ?", options[:min_priority]) if options.key?(:min_priority)
38
+ query = query.where("priority <= ?", options[:max_priority]) if options.key?(:max_priority)
39
39
  query = query.where(queue: queues) unless queues.empty?
40
40
  query.count
41
41
  when :active_record_2
@@ -29,7 +29,7 @@ module HireFire
29
29
  query = query.where(queue_name: queues) if queues.any?
30
30
  query = query.where(performed_at: nil)
31
31
  query = query.where.not(error_event: discarded_enum).or(query.where(error_event: nil)) if error_event_supported?
32
- query = query.where(scheduled_at: ..Time.now).or(query.where(scheduled_at: nil))
32
+ query = query.where("scheduled_at <= ?", Time.now).or(query.where(scheduled_at: nil))
33
33
  query = query.order(scheduled_at: :asc, created_at: :asc)
34
34
 
35
35
  if (job = query.first)
@@ -57,7 +57,7 @@ module HireFire
57
57
  query = query.where(queue_name: queues) if queues.any?
58
58
  query = query.where(performed_at: nil)
59
59
  query = query.where.not(error_event: discarded_enum).or(query.where(error_event: nil)) if error_event_supported?
60
- query = query.where(scheduled_at: ..Time.now).or(query.where(scheduled_at: nil))
60
+ query = query.where("scheduled_at <= ?", Time.now).or(query.where(scheduled_at: nil))
61
61
  query.count
62
62
  end
63
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HireFire
4
- VERSION = "1.0.7"
4
+ VERSION = "1.0.8"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hirefire-resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van Rooijen
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: appraisal
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.6.2
87
+ rubygems_version: 3.6.9
88
88
  specification_version: 4
89
89
  summary: HireFire integration library for Ruby applications
90
90
  test_files: []