judoscale-good_job 1.7.1 → 1.8.1

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: c0f5d1258c1984ca9b01d8f13fd925cdaf3e3ea1d4f930619f0ace8360a715e7
4
- data.tar.gz: 77076fa9d655f651231208ee4021a9f728f9497d26f3cf2c7082e796d238863e
3
+ metadata.gz: 06c278e0bd569a5c7aa77d97fcdf243ef0c4db4c6903214321a52756d60d4c8e
4
+ data.tar.gz: 04b5eb7462f5a65835074d8400e018533cf0a71a2b50f04806c23480e83c95db
5
5
  SHA512:
6
- metadata.gz: e43107bce2519b653db1cbe2267d242bc8aa5e68a35857bc6420689e667b0f8c7cd75a7d430574957572c8f47dc37c266de6eb91e04034b18fdd95301924eedd
7
- data.tar.gz: 064d96dec45d79e74111a52a652f8a933bae3093d7d2810d2ed4d49a170b3e2a72bc8c24e189396bc0d6cddb22221b2f3b0afa387e5b867ad72088b315fd9b19
6
+ metadata.gz: 9403915ebe4a1d9f66aa4003efa4b2e8fc420ef3a43ee49c0f572132fb8f63eb20ae030e0dec3e1ef160098e882f96f2174948cf22e7035e8c26eaab6023e821
7
+ data.tar.gz: 9b181debb28084b99ce30f4ee7621c4a1fe7a269e76b95145a57fbfbd10b9bf98149a05f8f185351410f545ff333492b454d571f01a31515e9b46020f1372ab1
@@ -9,19 +9,29 @@ module Judoscale
9
9
  class MetricsCollector < Judoscale::JobMetricsCollector
10
10
  include ActiveRecordHelper
11
11
 
12
+ def self.good_job_v4?
13
+ Gem::Version.new(::GoodJob::VERSION) >= Gem::Version.new("4")
14
+ end
15
+
16
+ def self.good_job_base_class
17
+ good_job_v4? ? ::GoodJob::Job : ::GoodJob::Execution
18
+ end
19
+
12
20
  def self.adapter_config
13
21
  Judoscale::Config.instance.good_job
14
22
  end
15
23
 
16
24
  def self.collect?(config)
17
- super && ActiveRecordHelper.table_exists_for_model?(::GoodJob::Execution)
25
+ super && ActiveRecordHelper.table_exists_for_model?(good_job_base_class)
18
26
  end
19
27
 
20
28
  def initialize
21
29
  super
22
30
 
31
+ @good_job_base_class = self.class.good_job_base_class
32
+
23
33
  queue_names = run_silently do
24
- ::GoodJob::Execution.select("distinct queue_name").map(&:queue_name)
34
+ @good_job_base_class.select("distinct queue_name").map(&:queue_name)
25
35
  end
26
36
  self.queues |= queue_names
27
37
  end
@@ -32,7 +42,7 @@ module Judoscale
32
42
 
33
43
  # logically we don't need the finished_at condition, but it lets postgres use the indexes
34
44
  oldest_execution_time_by_queue = run_silently do
35
- ::GoodJob::Execution
45
+ @good_job_base_class
36
46
  .where(performed_at: nil, finished_at: nil)
37
47
  .group(:queue_name)
38
48
  .pluck(:queue_name, Arel.sql("min(coalesce(scheduled_at, created_at))"))
@@ -42,7 +52,7 @@ module Judoscale
42
52
 
43
53
  if track_busy_jobs?
44
54
  busy_count_by_queue = run_silently do
45
- ::GoodJob::Execution.running.group(:queue_name).count
55
+ @good_job_base_class.running.group(:queue_name).count
46
56
  end
47
57
  self.queues |= busy_count_by_queue.keys
48
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judoscale-good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam McCrea
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-07-08 00:00:00.000000000 Z
13
+ date: 2024-09-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: judoscale-ruby
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.7.1
21
+ version: 1.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.7.1
28
+ version: 1.8.1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: good_job
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -35,7 +35,7 @@ dependencies:
35
35
  version: '3.0'
36
36
  - - "<"
37
37
  - !ruby/object:Gem::Version
38
- version: '4.0'
38
+ version: '5.0'
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -45,7 +45,7 @@ dependencies:
45
45
  version: '3.0'
46
46
  - - "<"
47
47
  - !ruby/object:Gem::Version
48
- version: '4.0'
48
+ version: '5.0'
49
49
  description:
50
50
  email:
51
51
  - hello@judoscale.com
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.5.11
83
+ rubygems_version: 3.5.16
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Autoscaling for Good Job workers.