solid_queue_autoscaler 1.0.4 → 1.0.6

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: 34a00ec2fcaa967d5d9ccb7788380f40e411989940e31e685d53f35a2505c7d2
4
- data.tar.gz: 57c6f53c0c177283cce94bfc7c16916dbd98646567fda50e946c1805e343c408
3
+ metadata.gz: 6d1e945e6bd1c3a829b31cb51d45e7f893132c471229ede955db5ca3e1eeafd6
4
+ data.tar.gz: 8935803c294a97075ec8d4f4f2359f9240445e983b3c45fafe7a6372392bc509
5
5
  SHA512:
6
- metadata.gz: 57f8c7f0d6a7a3010b30b3224da0f265b88048fa41d63f9dfe7651e1a3c2eca6ad6b9adbd3da512218e35dbafdbbf39d8e97dfc0b20fa5ffb5245bba85ad19ea
7
- data.tar.gz: 4180ec88ddcf52bc708403b83257ea422e6880ac581be009493ba05d524cfe33c1d0dd423eaded9b8824484ec9d76a4094da7e9a0bf08bceaa1ad5e56b59108e
6
+ metadata.gz: 8861196d50e311eb4aed36e35e493c90cd1962c00ca67387c5fd0af811e5be8d6365b5b604a699c909581bffd55bc517b38999318fac87649204f8c98f5172af
7
+ data.tar.gz: 3580c793cc29d098b72d782ee9812c61cfd47bdad08e8742b96620d6f6c1e97e776edf175e0e220d2aa43fef0c645d52eba4e45a3b592552bb094c6f3ff939f7
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.6] - 2025-01-16
11
+
12
+ ### Fixed
13
+ - Fixed Dashboard templates not being found (`MissingExactTemplate` error)
14
+ - View paths are now captured at class definition time instead of inside callbacks where `__dir__` was evaluated incorrectly
15
+ - Properly configures both engine and application view paths for reliable template resolution
16
+
17
+ ## [1.0.5] - 2025-01-16
18
+
19
+ ### Added
20
+ - Auto-detect `SolidQueue::Record.connection` for multi-database setups
21
+ - No longer need to manually configure `database_connection` when using Solid Queue's separate database
22
+ - Connection priority: 1) explicit `database_connection`, 2) `SolidQueue::Record.connection`, 3) `ActiveRecord::Base.connection`
23
+
10
24
  ## [1.0.4] - 2025-01-16
11
25
 
12
26
  ### Fixed
data/README.md CHANGED
@@ -193,6 +193,7 @@ The Kubernetes adapter uses the official `kubeclient` gem and supports:
193
193
  | `dry_run` | Boolean | `false` | Log decisions without making changes |
194
194
  | `queues` | Array | `nil` | Queue names to monitor (nil = all queues) |
195
195
  | `table_prefix` | String | `'solid_queue_'` | Solid Queue table name prefix |
196
+ | `database_connection` | Connection | auto | Database connection (auto-detects `SolidQueue::Record.connection`) |
196
197
 
197
198
  ### Worker Limits
198
199
 
@@ -110,7 +110,7 @@ module SolidQueueAutoscaler
110
110
  # Queue filtering (nil = all queues)
111
111
  @queues = nil
112
112
 
113
- # Database connection (defaults to ActiveRecord::Base.connection)
113
+ # Database connection (auto-detects SolidQueue::Record.connection if available)
114
114
  @database_connection = nil
115
115
 
116
116
  # Solid Queue table prefix (default: 'solid_queue_')
@@ -181,8 +181,20 @@ module SolidQueueAutoscaler
181
181
  scale_down_cooldown_seconds || cooldown_seconds
182
182
  end
183
183
 
184
+ # Returns the database connection for querying Solid Queue tables.
185
+ # Priority order:
186
+ # 1. Explicitly configured database_connection
187
+ # 2. SolidQueue::Record.connection (for multi-database setups)
188
+ # 3. ActiveRecord::Base.connection (fallback)
184
189
  def connection
185
- database_connection || ActiveRecord::Base.connection
190
+ return database_connection if database_connection
191
+
192
+ # Auto-detect Solid Queue's connection for multi-database setups
193
+ if defined?(SolidQueue::Record) && SolidQueue::Record.respond_to?(:connection)
194
+ return SolidQueue::Record.connection
195
+ end
196
+
197
+ ActiveRecord::Base.connection
186
198
  end
187
199
 
188
200
  def dry_run?
@@ -203,6 +215,12 @@ module SolidQueueAutoscaler
203
215
 
204
216
  def connection_available?
205
217
  return true if database_connection
218
+
219
+ # Check Solid Queue connection first (for multi-database setups)
220
+ if defined?(SolidQueue::Record) && SolidQueue::Record.respond_to?(:connected?)
221
+ return SolidQueue::Record.connected?
222
+ end
223
+
206
224
  return false unless defined?(ActiveRecord::Base)
207
225
 
208
226
  ActiveRecord::Base.connected?
@@ -22,13 +22,15 @@ module SolidQueueAutoscaler
22
22
  config.solid_queue_autoscaler_dashboard = ActiveSupport::OrderedOptions.new
23
23
  config.solid_queue_autoscaler_dashboard.title = 'Solid Queue Autoscaler'
24
24
 
25
- # Configure view paths
26
- config.paths['app/views'] = File.expand_path('views', __dir__)
25
+ # Capture views path at class definition time (not inside callbacks)
26
+ VIEWS_PATH = File.expand_path('views', __dir__).freeze
27
27
 
28
- initializer 'solid_queue_autoscaler.dashboard.view_paths' do
29
- ActiveSupport.on_load(:action_controller) do
30
- append_view_path File.expand_path('views', __dir__)
31
- end
28
+ # Configure view paths for the engine
29
+ config.paths['app/views'] << VIEWS_PATH
30
+
31
+ initializer 'solid_queue_autoscaler.dashboard.view_paths', before: :add_view_paths do |app|
32
+ # Add views path to the application's view paths
33
+ app.config.paths['app/views'] << VIEWS_PATH
32
34
  end
33
35
 
34
36
  initializer 'solid_queue_autoscaler.dashboard.integration' do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidQueueAutoscaler
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_queue_autoscaler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - reillyse