Module: Asynchronic

Extended by:
ClassConfig
Defined in:
lib/asynchronic.rb,
lib/asynchronic/job.rb,
lib/asynchronic/error.rb,
lib/asynchronic/process.rb,
lib/asynchronic/version.rb,
lib/asynchronic/environment.rb,
lib/asynchronic/data_store/key.rb,
lib/asynchronic/data_store/redis.rb,
lib/asynchronic/queue_engine/ost.rb,
lib/asynchronic/data_store/helper.rb,
lib/asynchronic/garbage_collector.rb,
lib/asynchronic/notifier/in_memory.rb,
lib/asynchronic/data_store/in_memory.rb,
lib/asynchronic/notifier/broadcaster.rb,
lib/asynchronic/data_store/lazy_store.rb,
lib/asynchronic/data_store/lazy_value.rb,
lib/asynchronic/queue_engine/in_memory.rb,
lib/asynchronic/data_store/scoped_store.rb,
lib/asynchronic/queue_engine/synchronic.rb,
lib/asynchronic/data_store/no_lazy_store.rb,
lib/asynchronic/data_store/readonly_store.rb

Defined Under Namespace

Modules: DataStore, Notifier, QueueEngine Classes: Environment, Error, GarbageCollector, Job, Process, Worker

Constant Summary collapse

VERSION =
'4.0.3'

Class Method Summary collapse

Class Method Details

.[](pid) ⇒ Object



36
37
38
# File 'lib/asynchronic.rb', line 36

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

.environmentObject



32
33
34
# File 'lib/asynchronic.rb', line 32

def self.environment
  Environment.new queue_engine, data_store, notifier
end

.establish_redis_connection(options = {}) ⇒ Object



48
49
50
51
52
# File 'lib/asynchronic.rb', line 48

def self.establish_redis_connection(options={})
  redis_client = options.fetch(:redis_client, Asynchronic.redis_client)
  redis_settings = options.fetch(:redis_settings, Asynchronic.redis_settings)
  redis_client.new redis_settings
end

.garbage_collectorObject



44
45
46
# File 'lib/asynchronic.rb', line 44

def self.garbage_collector
  @garbage_collector ||= GarbageCollector.new environment, garbage_collector_timeout
end

.processesObject



40
41
42
# File 'lib/asynchronic.rb', line 40

def self.processes
  environment.processes
end

.retry_execution(klass, message) ⇒ Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/asynchronic.rb', line 54

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