Sha256: 18ed780e3505c5f10f2462c2d2c9a7dd017e552f7d026ed72f9f0c938621ef0c

Contents?: true

Size: 739 Bytes

Versions: 6

Compression:

Stored size: 739 Bytes

Contents

module Blazer
  class RunStatementJob < ActiveJob::Base
    self.queue_adapter = :async

    def perform(data_source_id, statement, options)
      statement = Blazer::Statement.new(statement, data_source_id)
      statement.values = options.delete(:values)
      data_source = statement.data_source
      begin
        ActiveRecord::Base.connection_pool.with_connection do
          Blazer::RunStatement.new.perform(statement, options)
        end
      rescue Exception => e
        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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blazer-2.6.5 lib/blazer/run_statement_job.rb
blazer-2.6.4 lib/blazer/run_statement_job.rb
blazer-2.6.3 lib/blazer/run_statement_job.rb
blazer-2.6.2 lib/blazer/run_statement_job.rb
blazer-2.6.1 lib/blazer/run_statement_job.rb
blazer-2.6.0 lib/blazer/run_statement_job.rb