File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed
Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 1313 strategy :
1414 matrix :
1515 gemfile : [Gemfile, delayed.gemfile]
16- ruby-version : ['3.0 ', '3.1 ', '3.2 ']
16+ ruby-version : ['3.2 ', '3.3 ', '3.4 ']
1717 env :
1818 BUNDLE_GEMFILE : ${{ matrix.gemfile }}
1919 steps :
Original file line number Diff line number Diff line change @@ -179,5 +179,5 @@ jobs.
179179## License
180180
181181Delayed::Cron::Job is released under the terms of the MIT License.
182- Copyright 2014-2023 Pascal Zumkehr. See [ LICENSE] ( LICENSE ) for further
182+ Copyright 2014-2025 Pascal Zumkehr. See [ LICENSE] ( LICENSE ) for further
183183information.
Original file line number Diff line number Diff line change @@ -6,16 +6,6 @@ class TestJob
66 def perform ; end
77 end
88
9- class DatabaseDisconnectPlugin < Delayed ::Plugin
10-
11- callbacks do |lifecycle |
12- lifecycle . after ( :perform ) do
13- ActiveRecord ::Base . connection . disconnect!
14- end
15- end
16-
17- end
18-
199 before { Delayed ::Job . delete_all }
2010
2111 let ( :cron ) { '5 1 * * *' }
@@ -182,11 +172,25 @@ class DatabaseDisconnectPlugin < Delayed::Plugin
182172 end
183173
184174 context 'when database connection is lost' do
175+
176+ class DatabaseDisconnectPlugin < Delayed ::Plugin
177+ callbacks do |lifecycle |
178+ lifecycle . after ( :perform ) do
179+
180+ pp ActiveRecord ::Base . connection_pool . connections
181+ ActiveRecord ::Base . connection . disconnect!
182+ end
183+ end
184+ end
185+
185186 around ( :each ) do |example |
186187 Delayed ::Worker . plugins . unshift DatabaseDisconnectPlugin
187188 # hold onto a connection so the in-memory database isn't lost when disconnected
188189 temp_connection = ActiveRecord ::Base . connection_pool . checkout
190+ temp_connection . connect!
191+
189192 example . run
193+
190194 ActiveRecord ::Base . connection_pool . checkin temp_connection
191195 Delayed ::Worker . plugins . delete DatabaseDisconnectPlugin
192196 end
You can’t perform that action at this time.
0 commit comments