rails-autoscale-delayed_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: 78eaff0a876a18d4f17456c1aa3e1c75c668bc94029cd06415faf5540d36d645
4
- data.tar.gz: 6554e1b6294c8bdf5404d2719d908ee66416ec1fa05af34094e121627cf01bed
3
+ metadata.gz: 0c9eb8764a3ff25c9058452fea836fe610ec561ad681b8e8355f2b1da350d9af
4
+ data.tar.gz: 7b4dae30f30052810bf4c94c16bff0d2072a220bdba6212770bb9340eae8e330
5
5
  SHA512:
6
- metadata.gz: bda63f2c245390a362be024ca8f45441d9d6350729b772952ba0c09c58c321d46444be45c63a1b205870cbfe060991978109ff5fb7345c6329cbfb9af77c0f0d
7
- data.tar.gz: b0275ee600e0fb18cad13520103a961f53a991f033cfd3e0524283243af3864717caa181a631a1de2a179bb095320bfda820fe679412c4f02bc9f7eef0e5a84a
6
+ metadata.gz: 4f4f730c9ecd5a66967a7a832d6aca9199c97ffc33209371d959c1e9bebb5b2ac4b501fc7284a3cb8f52d642744c507ad2ace535216dc8af8637d068578aa178
7
+ data.tar.gz: a0ed935e680a7c2195d7779334291425a117129a9674d7c79b774c83d3dbe1186e256d9e222d72af1cc7b6b8618e09fb057eff259a955c38643693e843fcee97
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "judoscale/delayed_job"
3
+ require "judoscale-delayed_job"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-autoscale-delayed_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,36 +10,22 @@ 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
- name: rails-autoscale-core
16
+ name: judoscale-delayed_job
17
17
  requirement: !ruby/object:Gem::Requirement
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
29
- - !ruby/object:Gem::Dependency
30
- name: delayed_job_active_record
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: '4.0'
36
- type: :runtime
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: '4.0'
28
+ version: 1.8.0
43
29
  description:
44
30
  email:
45
31
  - hello@judoscale.com
@@ -47,17 +33,7 @@ executables: []
47
33
  extensions: []
48
34
  extra_rdoc_files: []
49
35
  files:
50
- - Gemfile
51
- - Gemfile-activerecord-6-1
52
- - Gemfile-activerecord-7-0
53
- - Rakefile
54
- - judoscale-delayed_job.gemspec
55
- - lib/judoscale-delayed_job.rb
56
- - lib/judoscale/delayed_job.rb
57
- - lib/judoscale/delayed_job/metrics_collector.rb
58
- - lib/judoscale/delayed_job/version.rb
59
36
  - lib/rails-autoscale-delayed_job.rb
60
- - rails-autoscale-delayed_job.gemspec
61
37
  homepage: https://judoscale.com
62
38
  licenses:
63
39
  - MIT
@@ -75,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
51
  requirements:
76
52
  - - ">="
77
53
  - !ruby/object:Gem::Version
78
- version: 2.6.0
54
+ version: '0'
79
55
  required_rubygems_version: !ruby/object:Gem::Requirement
80
56
  requirements:
81
57
  - - ">="
82
58
  - !ruby/object:Gem::Version
83
59
  version: '0'
84
60
  requirements: []
85
- rubygems_version: 3.4.10
61
+ rubygems_version: 3.5.11
86
62
  signing_key:
87
63
  specification_version: 4
88
64
  summary: Autoscaling for Delayed Job workers.
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec name: "judoscale-delayed_job"
4
-
5
- gem "judoscale-ruby", path: "../judoscale-ruby"
6
- gem "activerecord"
7
- gem "pg"
8
- gem "minitest"
9
- gem "rake"
10
- gem "debug"
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec name: "judoscale-delayed_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-delayed_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/delayed_job/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "judoscale-delayed_job"
7
- spec.version = Judoscale::DelayedJob::VERSION
8
- spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
9
- spec.email = ["hello@judoscale.com"]
10
-
11
- spec.summary = "Autoscaling for Delayed 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::DelayedJob::VERSION
29
- spec.add_dependency "delayed_job_active_record", ">= 4.0"
30
- end
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "judoscale/job_metrics_collector"
4
- require "judoscale/job_metrics_collector/active_record_helper"
5
- require "judoscale/metric"
6
-
7
- module Judoscale
8
- module DelayedJob
9
- class MetricsCollector < Judoscale::JobMetricsCollector
10
- include ActiveRecordHelper
11
-
12
- METRICS_SQL = ActiveRecordHelper.cleanse_sql(<<~SQL)
13
- SELECT COALESCE(queue, 'default'), min(run_at)
14
- FROM delayed_jobs
15
- WHERE locked_at IS NULL
16
- AND failed_at IS NULL
17
- GROUP BY queue
18
- SQL
19
-
20
- BUSY_METRICS_SQL = ActiveRecordHelper.cleanse_sql(<<~SQL)
21
- SELECT COALESCE(queue, 'default'), count(*)
22
- FROM delayed_jobs
23
- WHERE locked_at IS NOT NULL
24
- AND locked_by IS NOT NULL
25
- AND failed_at IS NULL
26
- GROUP BY 1
27
- SQL
28
-
29
- def self.adapter_config
30
- Judoscale::Config.instance.delayed_job
31
- end
32
-
33
- def self.collect?(config)
34
- super && ActiveRecordHelper.table_exists?("delayed_jobs")
35
- end
36
-
37
- def collect
38
- metrics = []
39
- t = Time.now.utc
40
-
41
- run_at_by_queue = select_rows_silently(METRICS_SQL).to_h
42
- self.queues |= run_at_by_queue.keys
43
-
44
- if track_busy_jobs?
45
- busy_count_by_queue = select_rows_silently(BUSY_METRICS_SQL).to_h
46
- self.queues |= busy_count_by_queue.keys
47
- end
48
-
49
- queues.each do |queue|
50
- run_at = run_at_by_queue[queue]
51
- # DateTime.parse assumes a UTC string
52
- run_at = DateTime.parse(run_at) if run_at.is_a?(String)
53
- latency_ms = run_at ? ((t - run_at) * 1000).ceil : 0
54
- latency_ms = 0 if latency_ms < 0
55
-
56
- metrics.push Metric.new(:qt, latency_ms, t, queue)
57
-
58
- if track_busy_jobs?
59
- busy_count = busy_count_by_queue[queue] || 0
60
- metrics.push Metric.new(:busy, busy_count, Time.now, queue)
61
- end
62
- end
63
-
64
- log_collection(metrics)
65
- metrics
66
- end
67
- end
68
- end
69
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Judoscale
4
- module DelayedJob
5
- VERSION = "1.7.0"
6
- end
7
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "judoscale-ruby"
4
- require "judoscale/config"
5
- require "judoscale/delayed_job/version"
6
- require "judoscale/delayed_job/metrics_collector"
7
- require "delayed_job_active_record"
8
-
9
- Judoscale.add_adapter :"judoscale-delayed_job",
10
- {
11
- adapter_version: Judoscale::DelayedJob::VERSION,
12
- framework_version: Gem.loaded_specs["delayed_job_active_record"].version.to_s # DJ doesn't have a `VERSION` constant
13
- },
14
- metrics_collector: Judoscale::DelayedJob::MetricsCollector,
15
- expose_config: Judoscale::Config::JobAdapterConfig.new(:delayed_job)
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "judoscale/delayed_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/delayed_job/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "rails-autoscale-delayed_job"
7
- spec.version = Judoscale::DelayedJob::VERSION
8
- spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
9
- spec.email = ["hello@judoscale.com"]
10
-
11
- spec.summary = "Autoscaling for Delayed 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::DelayedJob::VERSION
29
- spec.add_dependency "delayed_job_active_record", ">= 4.0"
30
- end