Sha256: 7e4236664d9a91018ff1ddcccd1e026ad1d14157d6409b98bbf243f479f4134c

Contents?: true

Size: 757 Bytes

Versions: 4

Compression:

Stored size: 757 Bytes

Contents

# encoding: utf-8
class MagicAddresses::AddressWorker
  include Sidekiq::Worker

  def perform( address_id = nil, counter = 1 )
    if address_id && address = ::MagicAddresses::Address.find( address_id.to_i )
      
      if address.fetch_address.present?
        puts "###"
        puts "### AddressWorker:[#{address_id}]:   #{address.fetch_address}"
        puts "###"
        address.trigger_complete_translated_attributes
      end
      
    else
      
      counter = counter.to_i
      puts "###"
      puts "### AddressWorker  =>  NO Address with ID: #{id} ...try ##{counter}"
      puts "###"
      if counter <= 3
        counter += 1
        ::MagicAddresses::AddressWorker.perform_in( 1.minute, id, counter )
      end
      
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
magic_addresses-0.0.44 lib/app/workers/magic_addresses/address_worker.rb
magic_addresses-0.0.43 lib/app/workers/magic_addresses/address_worker.rb
magic_addresses-0.0.42 lib/app/workers/magic_addresses/address_worker.rb
magic_addresses-0.0.41 lib/app/workers/magic_addresses/address_worker.rb