rails_autoscale_agent 0.11.0 → 0.12.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: f313cab3eefd93584c9d2484698d836ad19467b2e03cd26623003edcd1c64ad5
4
- data.tar.gz: d8b33799b6dc0c2e92b6fbe770de41ac7e104a8d887965cf35538ea9ab6b8acb
3
+ metadata.gz: 36f5471f01400a8db00951513b7387150c370c92ed968b1e2aea3c752e4e5006
4
+ data.tar.gz: a113b0ca9936451db2a05aa3c0792f100938baf4c036f1f87100ef991155d880
5
5
  SHA512:
6
- metadata.gz: 3208e51e66e87a9c5e076322c04f7f3594295d11ad2e5c16cdea5600372e02b70e50e15138788fe5d59a7d6854a8c59c908db5cdb28878386989c7e8fb2d9049
7
- data.tar.gz: 1b771752c5fde1c3cd534a4ef2aca0e5917d3343d10e97cfb5fdb64a89f72cd5343e4662af281c214a35459cb77759f7c19b5110fd8bed979b54ffeff97a1de0
6
+ metadata.gz: aa7ef93dbcb9ab8341b2d7f313428c6bf75908f0e5db40987463f811f33c9577c99e404dad94e423cd752bd31edb1196bfa41b7ec5ec3c5841c917deaf53b09c
7
+ data.tar.gz: 59893c8b34924505d1d954a60422b7e3c81feec1933616ccee1a6f717f696e8263397f2b95b178c9c340831e5e4fb469310efe92739751489c32c5759514d5f4
@@ -78,6 +78,7 @@ module RailsAutoscaleAgent
78
78
  config.max_request_size = result.data['max_request_size'] if result.data['max_request_size']
79
79
  worker_adapters_msg = worker_adapters.map { |a| a.class.name }.join(', ')
80
80
  logger.info "Reporter starting, will report every #{config.report_interval} seconds or so. Worker adapters: [#{worker_adapters_msg}]"
81
+ logger.warn "[DEPRECATION WARNING] rails_autoscale_agent is no longer maintained. Please switch to rails-autoscale-web as soon as possible."
81
82
  when AutoscaleApi::FailureResponse
82
83
  logger.error "Reporter failed to register: #{result.failure_message}"
83
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAutoscaleAgent
4
- VERSION = "0.11.0"
4
+ VERSION = "0.12.0"
5
5
  end
@@ -12,7 +12,7 @@ module RailsAutoscaleAgent
12
12
 
13
13
  def enabled?
14
14
  if defined?(::Delayed::Job) && defined?(::Delayed::Backend::ActiveRecord)
15
- log_msg = String.new("DelayedJob enabled (#{::ActiveRecord::Base.default_timezone})")
15
+ log_msg = String.new("DelayedJob enabled (#{default_timezone})")
16
16
  log_msg << " with long-running job support" if track_long_running_jobs?
17
17
  logger.info log_msg
18
18
  true
@@ -30,7 +30,7 @@ module RailsAutoscaleAgent
30
30
  GROUP BY queue
31
31
  SQL
32
32
 
33
- run_at_by_queue = Hash[select_rows(sql)]
33
+ run_at_by_queue = Hash[select_rows_silently(sql)]
34
34
 
35
35
  # Don't collect worker metrics if there are unreasonable number of queues
36
36
  if run_at_by_queue.size > Config.instance.max_queues
@@ -50,7 +50,7 @@ module RailsAutoscaleAgent
50
50
  GROUP BY 1
51
51
  SQL
52
52
 
53
- busy_count_by_queue = Hash[select_rows(sql)]
53
+ busy_count_by_queue = Hash[select_rows_silently(sql)]
54
54
  self.queues = queues | busy_count_by_queue.keys
55
55
  end
56
56
 
@@ -88,6 +88,24 @@ module RailsAutoscaleAgent
88
88
  Config.instance.track_long_running_jobs
89
89
  end
90
90
 
91
+ def default_timezone
92
+ if ::ActiveRecord.respond_to?(:default_timezone)
93
+ # Rails >= 7
94
+ ::ActiveRecord.default_timezone
95
+ else
96
+ # Rails < 7
97
+ ::ActiveRecord::Base.default_timezone
98
+ end
99
+ end
100
+
101
+ def select_rows_silently(sql)
102
+ if ::ActiveRecord::Base.logger.respond_to?(:silence)
103
+ ::ActiveRecord::Base.logger.silence { select_rows(sql) }
104
+ else
105
+ select_rows(sql)
106
+ end
107
+ end
108
+
91
109
  def select_rows(sql)
92
110
  # This ensures the agent doesn't hold onto a DB connection any longer than necessary
93
111
  ActiveRecord::Base.connection_pool.with_connection { |c| c.select_rows(sql) }
@@ -20,7 +20,7 @@ module RailsAutoscaleAgent
20
20
 
21
21
  def enabled?
22
22
  if defined?(::Que)
23
- logger.info "Que enabled (#{::ActiveRecord::Base.default_timezone})"
23
+ logger.info "Que enabled (#{default_timezone})"
24
24
  true
25
25
  end
26
26
  end
@@ -37,7 +37,7 @@ module RailsAutoscaleAgent
37
37
  GROUP BY 1
38
38
  SQL
39
39
 
40
- run_at_by_queue = Hash[select_rows(sql)]
40
+ run_at_by_queue = Hash[select_rows_silently(sql)]
41
41
 
42
42
  # Don't collect worker metrics if there are unreasonable number of queues
43
43
  if run_at_by_queue.size > Config.instance.max_queues
@@ -62,6 +62,24 @@ module RailsAutoscaleAgent
62
62
 
63
63
  private
64
64
 
65
+ def default_timezone
66
+ if ::ActiveRecord.respond_to?(:default_timezone)
67
+ # Rails >= 7
68
+ ::ActiveRecord.default_timezone
69
+ else
70
+ # Rails < 7
71
+ ::ActiveRecord::Base.default_timezone
72
+ end
73
+ end
74
+
75
+ def select_rows_silently(sql)
76
+ if ::ActiveRecord::Base.logger.respond_to?(:silence)
77
+ ::ActiveRecord::Base.logger.silence { select_rows(sql) }
78
+ else
79
+ select_rows(sql)
80
+ end
81
+ end
82
+
65
83
  def select_rows(sql)
66
84
  # This ensures the agent doesn't hold onto a DB connection any longer than necessary
67
85
  ActiveRecord::Base.connection_pool.with_connection { |c| c.select_rows(sql) }
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Adam McCrea"]
10
10
  spec.email = ["adam@adamlogic.com"]
11
11
 
12
- spec.summary = "This gem works with the Rails Autoscale Heroku add-on to automatically scale your web and worker dynos."
12
+ spec.summary = "[DEPRECATED] Please use the rails-autoscale-web gem"
13
13
  spec.homepage = "https://railsautoscale.com"
14
14
  spec.license = "MIT"
15
15
 
@@ -17,12 +17,17 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.required_ruby_version = '>= 2.5.0'
20
+ spec.post_install_message = <<~MSG
21
+ DEPRECATION WARNING: rails_autoscale_agent is no longer maintained.
22
+ Please install rails-autoscale-web instead.
23
+ See https://github.com/rails-autoscale/rails-autoscale-gems for more.
24
+ MSG
20
25
 
21
26
  spec.metadata = {
22
27
  "homepage_uri" => "https://railsautoscale.com",
23
- "bug_tracker_uri" => "https://github.com/adamlogic/rails_autoscale_agent/issues",
28
+ "bug_tracker_uri" => "https://github.com/rails-autoscale/rails-autoscale-gems/issues",
24
29
  "documentation_uri" => "https://railsautoscale.com/docs",
25
- "changelog_uri" => "https://github.com/adamlogic/rails_autoscale_agent/blob/master/CHANGELOG.md",
26
- "source_code_uri" => "https://github.com/adamlogic/rails_autoscale_agent",
30
+ "changelog_uri" => "https://github.com/rails-autoscale/rails-autoscale-gems/blob/master/CHANGELOG.md",
31
+ "source_code_uri" => "https://github.com/rails-autoscale/rails-autoscale-gems",
27
32
  }
28
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_autoscale_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam McCrea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-05 00:00:00.000000000 Z
11
+ date: 2022-09-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -53,11 +53,14 @@ licenses:
53
53
  - MIT
54
54
  metadata:
55
55
  homepage_uri: https://railsautoscale.com
56
- bug_tracker_uri: https://github.com/adamlogic/rails_autoscale_agent/issues
56
+ bug_tracker_uri: https://github.com/rails-autoscale/rails-autoscale-gems/issues
57
57
  documentation_uri: https://railsautoscale.com/docs
58
- changelog_uri: https://github.com/adamlogic/rails_autoscale_agent/blob/master/CHANGELOG.md
59
- source_code_uri: https://github.com/adamlogic/rails_autoscale_agent
60
- post_install_message:
58
+ changelog_uri: https://github.com/rails-autoscale/rails-autoscale-gems/blob/master/CHANGELOG.md
59
+ source_code_uri: https://github.com/rails-autoscale/rails-autoscale-gems
60
+ post_install_message: |
61
+ DEPRECATION WARNING: rails_autoscale_agent is no longer maintained.
62
+ Please install rails-autoscale-web instead.
63
+ See https://github.com/rails-autoscale/rails-autoscale-gems for more.
61
64
  rdoc_options: []
62
65
  require_paths:
63
66
  - lib
@@ -72,9 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
75
  - !ruby/object:Gem::Version
73
76
  version: '0'
74
77
  requirements: []
75
- rubygems_version: 3.2.15
78
+ rubygems_version: 3.2.32
76
79
  signing_key:
77
80
  specification_version: 4
78
- summary: This gem works with the Rails Autoscale Heroku add-on to automatically scale
79
- your web and worker dynos.
81
+ summary: "[DEPRECATED] Please use the rails-autoscale-web gem"
80
82
  test_files: []