rails-autoscale-delayed_job 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails-autoscale-delayed_job.rb +1 -1
- metadata +7 -31
- data/Gemfile +0 -10
- data/Gemfile-activerecord-6-1 +0 -9
- data/Gemfile-activerecord-7-0 +0 -9
- data/Rakefile +0 -11
- data/judoscale-delayed_job.gemspec +0 -30
- data/lib/judoscale/delayed_job/metrics_collector.rb +0 -69
- data/lib/judoscale/delayed_job/version.rb +0 -7
- data/lib/judoscale/delayed_job.rb +0 -15
- data/lib/judoscale-delayed_job.rb +0 -3
- data/rails-autoscale-delayed_job.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12a992fe5014bc594877bfbdf958a124880c1ef538bf42e6ce354b4966cbdc42
|
4
|
+
data.tar.gz: 76487d6d38b8c91fbf7cdda523aa85cb77897463b87ae7943289809c0d7284b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 362f4c84011d31fc1eaf77d7acbd7e85bfb21878f0f6a967709cb4739e135caf2d59d3d0446239232fb071c835c9fcb55ad7385de83e4356aab7c6c8e94ca915
|
7
|
+
data.tar.gz: f88d22e904a1aaf1d3f8c571277d0f5b46f189035d6966bde764dbe7ba44c2a21880a9673243c6d3fc92c7ae5cd82924b6f0ad157db143ffe4b0db1324377edb
|
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.
|
4
|
+
version: 1.7.1
|
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-
|
13
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
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.
|
21
|
+
version: 1.7.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.
|
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.7.1
|
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:
|
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.
|
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
data/Gemfile-activerecord-6-1
DELETED
data/Gemfile-activerecord-7-0
DELETED
data/Rakefile
DELETED
@@ -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,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,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
|