Skip to content

Commit

Permalink
queue: Add some public methods for easier testing
Browse files Browse the repository at this point in the history
  • Loading branch information
agis committed Jul 17, 2020
1 parent 9f1e6fb commit b69b8e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/rspecq/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class Queue
STATUS_INITIALIZING = "initializing".freeze
STATUS_READY = "ready".freeze

attr_reader :redis

def initialize(build_id, worker_id, redis_host)
@build_id = build_id
@worker_id = worker_id
Expand Down Expand Up @@ -157,6 +159,14 @@ def processed_jobs_count
@redis.scard(key_queue_processed)
end

def processed_jobs
@redis.smembers(key_queue_processed)
end

def requeued_jobs
@redis.hgetall(key_requeues)
end

def become_master
@redis.setnx(key_queue_status, STATUS_INITIALIZING)
end
Expand Down

0 comments on commit b69b8e1

Please sign in to comment.