Sha256: 944c4b8ea4f1b3dfcb757e028aa6998d26aa21491b611361058c96656ee7d053
Contents?: true
Size: 810 Bytes
Versions: 5
Compression:
Stored size: 810 Bytes
Contents
module Asynchronic class Job def initialize(process) @process = process end def params @process.params end def result(reference) @process[reference].result end def self.queue(name=nil) name ? @queue = name : @queue end def self.enqueue(params={}) process = Asynchronic.environment.create_process self, params process.enqueue process.id end private def async(type, params={}) @process.nest type, params nil end def set(key, value) @process.set key, value end def retry_when(exceptions, interval=1) yield rescue *exceptions => ex Asynchronic.logger.error(self.class) { "Retry for: #{ex.class} #{ex.message}" } sleep interval retry end end end
Version data entries
5 entries across 5 versions & 1 rubygems