diff --git a/lib/scheduler/defer.rb b/lib/scheduler/defer.rb index 7a2e8f53cb4..f8f37090bb2 100644 --- a/lib/scheduler/defer.rb +++ b/lib/scheduler/defer.rb @@ -74,6 +74,8 @@ module Scheduler end rescue => ex Discourse.handle_job_exception(ex, message: "Processing deferred code queue") + ensure + ActiveRecord::Base.connection_handler.clear_active_connections! end end