Sha256: f40412bd58e769b2c35127ed18a583efb3925b661c2f4e6879d075575e3c96f4

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

class MailCannon::SingleBarrel
  include Sidekiq::Worker

  def perform(envelope_id)
    aggregator = Librato::Metrics::Aggregator.new
    aggregator.time 'mailcannon.shooter.perform' do
      envelope_id = envelope_id['$oid'] if envelope_id['$oid']
      puts "sending MailCannon::Envelope.find('#{envelope_id}')"
    
      begin
        envelope = MailCannon::Envelope.find(envelope_id)
        if envelope.valid?
          response = envelope.send!
          unless response==true
            raise response
          end
        end  
      rescue Exception => e
        puts "unable to send MailCannon::Envelope.find(#{envelope_id})"
        puts e.backtrace
      end
    end
    aggregator.submit
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailcannon-0.0.3 lib/mailcannon/workers/single_barrel.rb
mailcannon-0.0.2 lib/mailcannon/workers/single_barrel.rb