Sha256: 47f348038b109c199569b0bb44f4acbc1399604330d5a9c0c8a0c199ae43aa42
Contents?: true
Size: 570 Bytes
Versions: 4
Compression:
Stored size: 570 Bytes
Contents
module Sidejobs class Queue def add(data, options={}) Job.create( data: data.to_json, queue: (options[:queue] || 'default'), priority: (options[:priority] || 0), scheduled_at: options[:schedule_at] ) end def fetch Job.where(status: %w(pending failing)).where( 'attempts < ?', Sidejobs.configuration.max_attempts ).where( 'scheduled_at <= ? OR scheduled_at IS NULL', Time.now ).order(priority: :desc).limit(Sidejobs.configuration.batch_size) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sidejobs-4.0.0.2 | lib/sidejobs/queue.rb |
sidejobs-4.0.0.1 | lib/sidejobs/queue.rb |
sidejobs-4.0.0.0 | lib/sidejobs/queue.rb |
sidejobs-0.0.1 | lib/sidejobs/queue.rb |