Class: Blazer::RunStatementJob

Inherits:
Object
  • Object
show all
Includes:
SuckerPunch::Job
Defined in:
lib/blazer/run_statement_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(result, data_source, statement, options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/blazer/run_statement_job.rb', line 8

def perform(result, data_source, statement, options)
  begin
    ActiveRecord::Base.connection_pool.with_connection do
      result << Blazer::RunStatement.new.perform(data_source, statement, options)
    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