solid_queue_autoscaler 1.0.18 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12251748d310789a1f51b7276742e216bb4f45c1baa17a70999210f65dce31a0
4
- data.tar.gz: 2ee4b1e5aada9cd196021b9cc18d84b2a3e8550ff4e42b430c98318dd5fe2267
3
+ metadata.gz: 8a4488b919923025829a72e3c9a23220a528f76499adfe1575b3f7484adca8ec
4
+ data.tar.gz: 19b2bf974f03231b8f060ebaaa12ff0ce214ee3bb89620a1b90981fee3e0410e
5
5
  SHA512:
6
- metadata.gz: bbac46ee43f97d0c4beac6e5c54c1edd646b82c673eb524833ce5c9e3a812808ec1229385af5c4a28eff98b10e9d5b7ca52b3a2cc87776d4cbe0f5a34ef3d3e4
7
- data.tar.gz: 9139d323751360748f79ea86263a59d6cf68eb4b1b7888d35659cf5c5fba76f0b9f3817b52695de98f388a4d981e7a20d363c608ecb3419239beeaf7943f4b25
6
+ metadata.gz: 4dac7f9c83dab082137824c6a730fb6bb68e042758f155aac8480067810904bc234b9f152c7ee023264b6fcb4eb09c2fbfebc43b668520b0fdb446cc66eb1dad
7
+ data.tar.gz: 56c9cc4d51523f1752fc36e70f8c3cc4cb83177c4e7c345c8972116d27b0e12812aedbe2839f8bcb958f4ea50dd20432f3a686d2e9217e2fbf2588bf0cbfe872
data/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.19] - 2025-02-02
11
+
12
+ ### Added
13
+ - **AutoscaleJob string/symbol validation** - Detects when `recurring.yml` passes a quoted string like `":all"` instead of the symbol `:all`
14
+ - Raises a helpful `ConfigurationError` with exact before/after YAML examples
15
+ - Plain strings like `"default"` are leniently converted to symbols
16
+ - New `normalize_worker_name` helper method with comprehensive tests
17
+
18
+ ### Improved
19
+ - **Better error message for missing Procfile process types** - When `batch_update` returns 404 (process type doesn't exist), the error now explains:
20
+ - The process type doesn't exist in the Procfile
21
+ - How to verify with `heroku ps -a <app_name>`
22
+ - That the configured `process_type` must exactly match a Procfile entry
23
+
10
24
  ## [1.0.18] - 2025-01-31
11
25
 
12
26
  ### Fixed
@@ -115,9 +115,24 @@ module SolidQueueAutoscaler
115
115
  end
116
116
  quantity
117
117
  rescue Excon::Error => e
118
+ status = e.respond_to?(:response) ? e.response&.status : nil
119
+
120
+ # 404 from batch_update means the process type doesn't exist in the Procfile
121
+ # This is different from 404 on formation.update (which means scaled to 0)
122
+ if status == 404
123
+ raise HerokuAPIError.new(
124
+ "Process type '#{process_type}' does not exist. " \
125
+ "Verify that '#{process_type}:' is defined in your Procfile. " \
126
+ "Available process types can be viewed with 'heroku ps -a #{app_name}' or in your Procfile. " \
127
+ "The configured process_type must exactly match a Procfile entry.",
128
+ status_code: status,
129
+ response_body: e.respond_to?(:response) ? e.response&.body : nil
130
+ )
131
+ end
132
+
118
133
  raise HerokuAPIError.new(
119
134
  "Failed to create formation #{process_type} with quantity #{quantity}: #{e.message}",
120
- status_code: e.respond_to?(:response) ? e.response&.status : nil,
135
+ status_code: status,
121
136
  response_body: e.respond_to?(:response) ? e.response&.body : nil
122
137
  )
123
138
  end
@@ -21,6 +21,8 @@ module SolidQueueAutoscaler
21
21
  # @param worker_name [Symbol] The worker type to scale (:default, :critical_worker, etc.)
22
22
  # Pass :all to scale all registered workers
23
23
  def perform(worker_name = :default)
24
+ worker_name = normalize_worker_name(worker_name)
25
+
24
26
  if worker_name == :all
25
27
  perform_scale_all
26
28
  else
@@ -79,5 +81,33 @@ module SolidQueueAutoscaler
79
81
  worker_label = worker_name == :default ? '' : "[#{worker_name}] "
80
82
  Rails.logger.error("[AutoscaleJob] #{worker_label}Failed: #{result.error&.message}")
81
83
  end
84
+
85
+ # Normalize and validate worker_name argument.
86
+ # Detects common YAML misconfiguration where symbols are quoted as strings.
87
+ #
88
+ # @param worker_name [Symbol, String] The worker name to normalize
89
+ # @return [Symbol] The normalized worker name as a symbol
90
+ # @raise [ConfigurationError] If a string that looks like a symbol is passed
91
+ def normalize_worker_name(worker_name)
92
+ return worker_name if worker_name.is_a?(Symbol)
93
+
94
+ # Detect strings that look like symbols (e.g., ":all", ":default")
95
+ # This is a common YAML misconfiguration
96
+ if worker_name.is_a?(String) && worker_name.start_with?(':')
97
+ symbol_name = worker_name[1..] # Remove the leading colon
98
+ raise ConfigurationError,
99
+ "Invalid worker_name argument: received string #{worker_name.inspect} instead of symbol :#{symbol_name}. " \
100
+ "In your recurring.yml, change:\n" \
101
+ " args:\n" \
102
+ " - \"#{worker_name}\"\n" \
103
+ "to:\n" \
104
+ " args:\n" \
105
+ " - :#{symbol_name}\n" \
106
+ '(Remove the quotes around the symbol)'
107
+ end
108
+
109
+ # Convert plain strings to symbols (lenient mode)
110
+ worker_name.to_sym
111
+ end
82
112
  end
83
113
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidQueueAutoscaler
4
- VERSION = '1.0.18'
4
+ VERSION = '1.0.19'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_queue_autoscaler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.18
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - reillyse
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-31 00:00:00.000000000 Z
11
+ date: 2026-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord