FIX: Exception has to be wrapped in the connection as well.
This commit is contained in:
parent
09721090a3
commit
36f8697a59
|
@ -63,17 +63,14 @@ module Scheduler
|
||||||
# using non_block to match Ruby #deq
|
# using non_block to match Ruby #deq
|
||||||
def do_work(non_block = false)
|
def do_work(non_block = false)
|
||||||
db, job, desc = @queue.deq(non_block)
|
db, job, desc = @queue.deq(non_block)
|
||||||
|
db ||= RailsMultisite::ConnectionManagement::DEFAULT
|
||||||
|
|
||||||
begin
|
RailsMultisite::ConnectionManagement.with_connection(db: db) do
|
||||||
if db
|
begin
|
||||||
RailsMultisite::ConnectionManagement.with_connection(db: db) do
|
|
||||||
job.call
|
|
||||||
end
|
|
||||||
else
|
|
||||||
job.call
|
job.call
|
||||||
|
rescue => ex
|
||||||
|
Discourse.handle_job_exception(ex, message: "Running deferred code '#{desc}'")
|
||||||
end
|
end
|
||||||
rescue => ex
|
|
||||||
Discourse.handle_job_exception(ex, message: "Running deferred code '#{desc}'")
|
|
||||||
end
|
end
|
||||||
rescue => ex
|
rescue => ex
|
||||||
Discourse.handle_job_exception(ex, message: "Processing deferred code queue")
|
Discourse.handle_job_exception(ex, message: "Processing deferred code queue")
|
||||||
|
|
Loading…
Reference in New Issue