Skip to content

Commit

Permalink
Show async errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jul 28, 2016
1 parent 41bfbf6 commit e8f8493
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/blazer/run_statement_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ class RunStatementJob
workers 4

def perform(result, data_source, statement, options)
ActiveRecord::Base.connection_pool.with_connection do
data_source.connection_model.connection_pool.with_connection do
result << RunStatement.new.perform(data_source, statement, options)
begin
ActiveRecord::Base.connection_pool.with_connection do
data_source.connection_model.connection_pool.with_connection do
result << RunStatement.new.perform(data_source, statement, options)
end
end
rescue Exception => e
result.clear
result << Blazer::Result.new(data_source, [], [], "Unknown error", nil, false)
Blazer.cache.write(data_source.run_cache_key(options[:run_id]), Marshal.dump([[], [], "Unknown error", nil]), expires_in: 30.seconds)
raise e
end
end
end
Expand Down

0 comments on commit e8f8493

Please sign in to comment.