Sha256: 572b9d8251f6e1ce92703f13d0ce9ffe74ee772884d1da460e28dd0da2a94335
Contents?: true
Size: 834 Bytes
Versions: 4
Compression:
Stored size: 834 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 attr_reader :process 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
asynchronic-1.5.2 | lib/asynchronic/job.rb |
asynchronic-1.5.1 | lib/asynchronic/job.rb |
asynchronic-1.5.0 | lib/asynchronic/job.rb |
asynchronic-1.4.0 | lib/asynchronic/job.rb |