Sha256: 63049655da06d48473d6576f4a4064cecf7fb723b69a51c8424154c14dd73ab7

Contents?: true

Size: 939 Bytes

Versions: 5

Compression:

Stored size: 939 Bytes

Contents

require 'forwardable'
require 'securerandom'
require 'redis'
require 'ost'
require 'class_config'
require 'transparent_proxy'
require 'logger'

Dir.glob(File.expand_path('asynchronic/**/*.rb', File.dirname(__FILE__))).sort.each { |f| require f }

module Asynchronic

  extend ClassConfig

  attr_config :default_queue, :asynchronic
  attr_config :queue_engine, QueueEngine::InMemory.new
  attr_config :data_store, DataStore::InMemory.new
  attr_config :logger, Logger.new($stdout)

  RETRY_TIMEOUT = 30
  
  def self.environment
    Environment.new queue_engine, data_store
  end

  def self.[](pid)
    environment.load_process pid
  end

  def self.processes
    environment.processes
  end

  def self.retry_execution(a_class, message)
    begin
      result = yield
    rescue Exception => ex
      logger.info(a_class) { "Retrying #{message}. ERROR: #{ex.message}" }
      sleep RETRY_TIMEOUT
      retry
    end
    result
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
asynchronic-1.2.1 lib/asynchronic.rb
asynchronic-1.2.0 lib/asynchronic.rb
asynchronic-1.1.1 lib/asynchronic.rb
asynchronic-1.1.0 lib/asynchronic.rb
asynchronic-1.0.0 lib/asynchronic.rb