Sha256: c6ef2360b7bf6301747ea738eb49bb03272a9fd46223de4ae17f00ed1a72c426

Contents?: true

Size: 462 Bytes

Versions: 7

Compression:

Stored size: 462 Bytes

Contents

require 'rest-client'

Application.load 'lib/smartkiosk/sidekiq'

module Sync
  class IconsWorker
    include Sidekiq::Worker

    sidekiq_options :retry => false, :queue => :sync

    def perform(model, id, url)
      entity  = model.constantize.find(id)
      attempt = entity.update_attributes :remote_icon_url => "#{Terminal.config.host}/#{url}"

      unless attempt
        Sync::IconsWorker.perform_in(1.minute, model, id, url)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
smartkiosk-client-0.0.10 app/workers/sync/icons_worker.rb
smartkiosk-client-0.0.9 app/workers/sync/icons_worker.rb
smartkiosk-client-0.0.8 app/workers/sync/icons_worker.rb
smartkiosk-client-0.0.7 app/workers/sync/icons_worker.rb
smartkiosk-client-0.0.6 app/workers/sync/icons_worker.rb
smartkiosk-client-0.0.5 app/workers/sync/icons_worker.rb
smartkiosk-client-0.0.4 app/workers/sync/icons_worker.rb