Sha256: 2344c1dcf6cf5e05fb51818cb8a4aa998cd7dc79b15f28f2bdcf57682c7e3247

Contents?: true

Size: 1011 Bytes

Versions: 8

Compression:

Stored size: 1011 Bytes

Contents

module BridgeCache::Jobs
  class ImportCheck < ActiveJob::Base
    queue_as :default
    include BridgeCache::Utils::WorkerHelper

    def perform(bridge_base_url, bridge_api_key, bridge_api_secret, models, chain = [])
      remote_data = BridgeBlueprint::RemoteData.new(bridge_base_url, bridge_api_key, bridge_api_secret)
      if remote_data.status == BridgeBlueprint::Constants::STATUS_COMPLETE
        BridgeCache::Jobs::ImportData.set(queue: self.queue_name).perform_later(bridge_base_url, bridge_api_key, bridge_api_secret, models, chain)
      elsif remote_data.status == BridgeBlueprint::Constants::STATUS_PENDING
        BridgeCache::Jobs::ImportCheck.set(queue: self.queue_name, wait: 30.seconds).perform_later(bridge_base_url, bridge_api_key, bridge_api_secret, models, chain)
      elsif remote_data.status == BridgeBlueprint::Constants::STATUS_FAILED || remote_data.status == BridgeBluePrint::Constants::STATUS_NOT_FOUND
        raise 'Bridge data dump download failed'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bridge_cache-0.0.14 app/lib/bridge_cache/jobs/import_check.rb
bridge_cache-0.0.13 app/lib/bridge_cache/jobs/import_check.rb
bridge_cache-0.0.12 app/lib/bridge_cache/jobs/import_check.rb
bridge_cache-0.0.11 app/lib/bridge_cache/jobs/import_check.rb
bridge_cache-0.0.9 app/lib/bridge_cache/jobs/import_check.rb
bridge_cache-0.0.8 lib/bridge_cache/jobs/import_check.rb
bridge_cache-0.0.7 lib/bridge_cache/jobs/import_check.rb
bridge_cache-0.0.6 lib/bridge_cache/jobs/import_check.rb