Sha256: c9f3ce09384dfb48ef6389ad00555245ada6853a4ea8104211ad465617432ca4
Contents?: true
Size: 708 Bytes
Versions: 2
Compression:
Stored size: 708 Bytes
Contents
class GemeraldBeanstalk::Jobs < ThreadSafe::Array attr_reader :total_jobs def counts_by_state job_stats = { 'current-jobs-urgent' => 0, 'current-jobs-ready' => 0, 'current-jobs-reserved' => 0, 'current-jobs-delayed' => 0, 'current-jobs-buried' => 0, } self.compact.each do |job| state = job.state job_stats["current-jobs-#{state}"] += 1 job_stats['current-jobs-urgent'] += 1 if state == :ready && job.priority < 1024 end return job_stats end def enqueue(job) @total_jobs += 1 push(job) return self end def initialize(*) @total_jobs = 0 super end def next_id return @total_jobs + 1 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gemerald_beanstalk-0.1.0 | lib/gemerald_beanstalk/jobs.rb |
gemerald_beanstalk-0.0.1 | lib/gemerald_beanstalk/jobs.rb |