Sha256: b68f59d3af8a21c82f2b8433bc1a545d40612f7d583d7606b20caf4f94f13ab8

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'bluth'
require 'bluth/test_helpers'

Bluth::Queue.critical.clear

## Knows queue names
Bluth::Queue.queues.collect(&:name)
#=> [:critical, :high, :low, :running, :successful, :failed, :orphaned]

## Knows queue keys
Bluth::Queue.queues.collect(&:rediskey)
#=> ["bluth:queue:critical", "bluth:queue:high", "bluth:queue:low", "bluth:queue:running", "bluth:queue:successful", "bluth:queue:failed", "bluth:queue:orphaned"]

## Knows a queue
ret = Bluth::Queue.critical
ret.class
#=> Familia::List

## Can push on to a queue
Bluth::Queue.critical.push 'job1'
Bluth::Queue.critical.push 'job2'
Bluth::Queue.critical.push 'job3'
Bluth::Queue.critical.size
#=> 3

## Can shift from a queue
job = Bluth::Queue.critical.shift
#=> 'job1'


## Can create a queue on the fly
q = Bluth::Queue.create_queue :anything
q.rediskey
#=> "bluth:queue:anything"

## And that new queue has a method
q = Bluth::Queue.queue :anything
q.class
#=> Familia::List

## We can get a list of queues by priority
Bluth::Queue.entry_queues.collect { |q| q.name }
#=> [:critical, :high, :low]


Bluth::Queue.critical.clear

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bluth-0.7.2 try/15_queue_try.rb
bluth-0.7.0 try/15_queue_try.rb