rails-autoscale-que 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bee374e8fd44b4e4f4e8a6bdd7c99126124d8541884be3df4295f6a61d2fe6d6
4
- data.tar.gz: 5616ab915a67a420cecab35b47239834e7137b7eb1b571d6966a41a20f6039b8
3
+ metadata.gz: b21dacd63c8eea001a1f991407980e9c5df8cd2434a874e1084335643aa4ec1e
4
+ data.tar.gz: fc641c057bf2c3d1828c578cae58c6c9a9dc0fdff199504051bc03037dd79e18
5
5
  SHA512:
6
- metadata.gz: 765bfec943878b9de999b8e69512a32471e45e7f6bd68cd5903027fe0c54e31957ae97b69804f9815278d6759fac1df88f2a913e9da7f0312b77a05a58052967
7
- data.tar.gz: a9a0df37d1b2a76e213c46c2fd2de732c8830bbf04f1ed30fb81d1121fcda7096537517e7bfe49b3872c3130198ffb66a8c9e633a7229ef86513e216fa36b0f3
6
+ metadata.gz: b3fc9d80db768b1590674bb25c4bfe2c542b69ca3b509c9c3bfb675c773dd26a141dfd4d3ef554066967bebfb45807945531a363263564bf813cad684b056ed9
7
+ data.tar.gz: b7f898473657f56fec12e2df0983f63ad5970488ca67c28c4f0dc383c9ddd8712cccbf059281da4629be1de82eb6b02ffcd3e275a6d7784e6fa5d4dac5bd7d23
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "judoscale/que"
3
+ require "judoscale-que"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-autoscale-que
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
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-05-03 00:00:00.000000000 Z
13
+ date: 2024-07-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rails-autoscale-core
16
+ name: judoscale-que
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.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.0
29
- - !ruby/object:Gem::Dependency
30
- name: que
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: '1.0'
36
- type: :runtime
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: '1.0'
28
+ version: 1.7.1
43
29
  description:
44
30
  email:
45
31
  - hello@judoscale.com
@@ -47,18 +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
- - Gemfile-que-1
54
- - Rakefile
55
- - judoscale-que.gemspec
56
- - lib/judoscale-que.rb
57
- - lib/judoscale/que.rb
58
- - lib/judoscale/que/metrics_collector.rb
59
- - lib/judoscale/que/version.rb
60
36
  - lib/rails-autoscale-que.rb
61
- - rails-autoscale-que.gemspec
62
37
  homepage: https://judoscale.com
63
38
  licenses:
64
39
  - MIT
@@ -76,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
51
  requirements:
77
52
  - - ">="
78
53
  - !ruby/object:Gem::Version
79
- version: 2.6.0
54
+ version: '0'
80
55
  required_rubygems_version: !ruby/object:Gem::Requirement
81
56
  requirements:
82
57
  - - ">="
83
58
  - !ruby/object:Gem::Version
84
59
  version: '0'
85
60
  requirements: []
86
- rubygems_version: 3.4.10
61
+ rubygems_version: 3.5.11
87
62
  signing_key:
88
63
  specification_version: 4
89
64
  summary: Autoscaling for Que workers.
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec name: "judoscale-que"
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-que"
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-que"
4
-
5
- gem "judoscale-ruby", path: "../judoscale-ruby"
6
- gem "activerecord", "~> 7.0"
7
- gem "pg"
8
- gem "minitest"
9
- gem "rake"
data/Gemfile-que-1 DELETED
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec name: "judoscale-que"
4
-
5
- gem "judoscale-ruby", path: "../judoscale-ruby"
6
- gem "que", "~> 1.0"
7
- gem "activerecord"
8
- gem "pg"
9
- gem "minitest"
10
- 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/que/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "judoscale-que"
7
- spec.version = Judoscale::Que::VERSION
8
- spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
9
- spec.email = ["hello@judoscale.com"]
10
-
11
- spec.summary = "Autoscaling for Que 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::Que::VERSION
29
- spec.add_dependency "que", ">= 1.0"
30
- end
@@ -1,76 +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 Que
9
- class MetricsCollector < Judoscale::JobMetricsCollector
10
- include ActiveRecordHelper
11
-
12
- METRICS_SQL = ActiveRecordHelper.cleanse_sql(<<~SQL)
13
- SELECT queue, min(run_at)
14
- FROM que_jobs
15
- WHERE finished_at IS NULL
16
- AND expired_at IS NULL
17
- AND error_count = 0
18
- AND id NOT IN (
19
- SELECT (classid::bigint << 32) + objid::bigint AS id
20
- FROM pg_locks
21
- WHERE locktype = 'advisory'
22
- )
23
- GROUP BY 1
24
- SQL
25
-
26
- BUSY_METRICS_SQL = ActiveRecordHelper.cleanse_sql(<<~SQL)
27
- SELECT queue, count(*)
28
- FROM que_jobs
29
- WHERE id IN (
30
- SELECT (classid::bigint << 32) + objid::bigint AS id
31
- FROM pg_locks
32
- WHERE locktype = 'advisory'
33
- )
34
- GROUP BY 1
35
- SQL
36
-
37
- def self.adapter_config
38
- Judoscale::Config.instance.que
39
- end
40
-
41
- def self.collect?(config)
42
- super && ActiveRecordHelper.table_exists?("que_jobs")
43
- end
44
-
45
- def collect
46
- metrics = []
47
- t = Time.now.utc
48
-
49
- run_at_by_queue = select_rows_silently(METRICS_SQL).to_h
50
- self.queues |= run_at_by_queue.keys
51
-
52
- if track_busy_jobs?
53
- busy_count_by_queue = select_rows_silently(BUSY_METRICS_SQL).to_h
54
- self.queues |= busy_count_by_queue.keys
55
- end
56
-
57
- queues.each do |queue|
58
- run_at = run_at_by_queue[queue]
59
- run_at = DateTime.parse(run_at) if run_at.is_a?(String)
60
- latency_ms = run_at ? ((t - run_at) * 1000).ceil : 0
61
- latency_ms = 0 if latency_ms < 0
62
-
63
- metrics.push Metric.new(:qt, latency_ms, t, queue)
64
-
65
- if track_busy_jobs?
66
- busy_count = busy_count_by_queue[queue] || 0
67
- metrics.push Metric.new(:busy, busy_count, Time.now, queue)
68
- end
69
- end
70
-
71
- log_collection(metrics)
72
- metrics
73
- end
74
- end
75
- end
76
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Judoscale
4
- module Que
5
- VERSION = "1.7.0"
6
- end
7
- end
data/lib/judoscale/que.rb DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "judoscale-ruby"
4
- require "judoscale/config"
5
- require "judoscale/que/version"
6
- require "judoscale/que/metrics_collector"
7
- require "que"
8
-
9
- Judoscale.add_adapter :"judoscale-que",
10
- {
11
- adapter_version: Judoscale::Que::VERSION,
12
- framework_version: ::Que::VERSION
13
- },
14
- metrics_collector: Judoscale::Que::MetricsCollector,
15
- expose_config: Judoscale::Config::JobAdapterConfig.new(:que)
data/lib/judoscale-que.rb DELETED
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "judoscale/que"
@@ -1,30 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "judoscale/que/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "rails-autoscale-que"
7
- spec.version = Judoscale::Que::VERSION
8
- spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
9
- spec.email = ["hello@judoscale.com"]
10
-
11
- spec.summary = "Autoscaling for Que 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::Que::VERSION
29
- spec.add_dependency "que", ">= 1.0"
30
- end