judoscale-good_job 1.7.0 → 1.8.0

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: 1df50c38532a91549a2939e7b1e5f79fbcb6ec2be58ba804a7fbb45996a2d8fd
4
- data.tar.gz: 1650b18d7167261fa17579ea94ceed78c9223d41bb279c4468db786fa5ea10b8
3
+ metadata.gz: dac87de18dfef986786bf05140ce577ad215ee07096dbed0a236165925c62098
4
+ data.tar.gz: 6e8a9c2131e19295869fc354c71160ee4bf6a913d674c0cf7bf827875b389685
5
5
  SHA512:
6
- metadata.gz: 4c6ff8f697a5a3ab169560b97a2916fcfa13c7ab9d663cdada7deb0c36226ce770386cb9bb3dff92529b04a1e5a2ffc2b6c908c02be17b22a6564cd42a36ac6e
7
- data.tar.gz: eb0ccceeb377d0c39e03627671150a09db5ff7f94b52bd139f267d82166f98df7c1ce2845ceb702a812c83114079bbcd97b62509d2229b1ce16c7209a1f56571
6
+ metadata.gz: 225bd45625c073cdff0c306aa741281ca4e9aadfe7287b73f781531e29fe6997936135838f8b44d0b5a3391f84d9fe968746682ccb76f3b4fe0ed3a8f74433c7
7
+ data.tar.gz: 9a64e9bc3fb6b4a7649cc23889021b4e7bc5b850f1c3967ce028d410134f1f4f15c5dc1db6f274b457939f722575e38a09150315213bedb2f24ec2c0d4c49e7d
@@ -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
@@ -7,12 +7,12 @@ require "active_job/railtie"
7
7
  require "good_job"
8
8
  require "judoscale-ruby"
9
9
  require "judoscale/config"
10
- require "judoscale/good_job/version"
10
+ require "judoscale/version"
11
11
  require "judoscale/good_job/metrics_collector"
12
12
 
13
13
  Judoscale.add_adapter :"judoscale-good_job",
14
14
  {
15
- adapter_version: Judoscale::GoodJob::VERSION,
15
+ adapter_version: Judoscale::VERSION,
16
16
  framework_version: ::GoodJob::VERSION
17
17
  },
18
18
  metrics_collector: Judoscale::GoodJob::MetricsCollector,
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.0
4
+ version: 1.8.0
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-05-03 00:00:00.000000000 Z
13
+ date: 2024-07-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.0
21
+ version: 1.8.0
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.0
28
+ version: 1.8.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: good_job
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -33,6 +33,9 @@ dependencies:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '3.0'
36
+ - - "<"
37
+ - !ruby/object:Gem::Version
38
+ version: '5.0'
36
39
  type: :runtime
37
40
  prerelease: false
38
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -40,6 +43,9 @@ dependencies:
40
43
  - - ">="
41
44
  - !ruby/object:Gem::Version
42
45
  version: '3.0'
46
+ - - "<"
47
+ - !ruby/object:Gem::Version
48
+ version: '5.0'
43
49
  description:
44
50
  email:
45
51
  - hello@judoscale.com
@@ -47,17 +53,9 @@ executables: []
47
53
  extensions: []
48
54
  extra_rdoc_files: []
49
55
  files:
50
- - Gemfile
51
- - Gemfile-activerecord-6-1
52
- - Gemfile-activerecord-7-0
53
- - Rakefile
54
- - judoscale-good_job.gemspec
55
56
  - lib/judoscale-good_job.rb
56
57
  - lib/judoscale/good_job.rb
57
58
  - lib/judoscale/good_job/metrics_collector.rb
58
- - lib/judoscale/good_job/version.rb
59
- - lib/rails-autoscale-good_job.rb
60
- - rails-autoscale-good_job.gemspec
61
59
  homepage: https://judoscale.com
62
60
  licenses:
63
61
  - MIT
@@ -82,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
80
  - !ruby/object:Gem::Version
83
81
  version: '0'
84
82
  requirements: []
85
- rubygems_version: 3.4.10
83
+ rubygems_version: 3.5.11
86
84
  signing_key:
87
85
  specification_version: 4
88
86
  summary: Autoscaling for Good Job workers.
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec name: "judoscale-good_job"
4
-
5
- gem "judoscale-ruby", path: "../judoscale-ruby"
6
- gem "activerecord"
7
- gem "pg"
8
- gem "minitest"
9
- gem "rake"
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec name: "judoscale-good_job"
4
-
5
- gem "judoscale-ruby", path: "../judoscale-ruby"
6
- gem "activerecord", "~> 6.1"
7
- gem "pg"
8
- gem "minitest"
9
- gem "rake"
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec name: "judoscale-good_job"
4
-
5
- gem "judoscale-ruby", path: "../judoscale-ruby"
6
- gem "activerecord", "~> 7.0"
7
- gem "pg"
8
- gem "minitest"
9
- gem "rake"
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rake/testtask"
4
-
5
- Rake::TestTask.new(:test) do |t|
6
- t.libs << "lib"
7
- t.libs << "test"
8
- t.test_files = FileList["test/**/*_test.rb"]
9
- end
10
-
11
- task default: :test
@@ -1,30 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "judoscale/good_job/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "judoscale-good_job"
7
- spec.version = Judoscale::GoodJob::VERSION
8
- spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
9
- spec.email = ["hello@judoscale.com"]
10
-
11
- spec.summary = "Autoscaling for Good Job workers."
12
- spec.homepage = "https://judoscale.com"
13
- spec.license = "MIT"
14
-
15
- spec.metadata = {
16
- "homepage_uri" => "https://judoscale.com",
17
- "bug_tracker_uri" => "https://github.com/judoscale/judoscale-ruby/issues",
18
- "documentation_uri" => "https://judoscale.com/docs",
19
- "changelog_uri" => "https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md",
20
- "source_code_uri" => "https://github.com/judoscale/judoscale-ruby"
21
- }
22
-
23
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
- spec.require_paths = ["lib"]
25
-
26
- spec.required_ruby_version = ">= 2.6.0"
27
-
28
- spec.add_dependency "judoscale-ruby", Judoscale::GoodJob::VERSION
29
- spec.add_dependency "good_job", ">= 3.0"
30
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Judoscale
4
- module GoodJob
5
- VERSION = "1.7.0"
6
- end
7
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "judoscale/good_job"
@@ -1,30 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "judoscale/good_job/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "rails-autoscale-good_job"
7
- spec.version = Judoscale::GoodJob::VERSION
8
- spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
9
- spec.email = ["hello@judoscale.com"]
10
-
11
- spec.summary = "Autoscaling for Good Job workers."
12
- spec.homepage = "https://judoscale.com"
13
- spec.license = "MIT"
14
-
15
- spec.metadata = {
16
- "homepage_uri" => "https://judoscale.com",
17
- "bug_tracker_uri" => "https://github.com/judoscale/judoscale-ruby/issues",
18
- "documentation_uri" => "https://judoscale.com/docs",
19
- "changelog_uri" => "https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md",
20
- "source_code_uri" => "https://github.com/judoscale/judoscale-ruby"
21
- }
22
-
23
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
- spec.require_paths = ["lib"]
25
-
26
- spec.required_ruby_version = ">= 2.6.0"
27
-
28
- spec.add_dependency "rails-autoscale-core", Judoscale::GoodJob::VERSION
29
- spec.add_dependency "good_job", ">= 3.0"
30
- end