Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Review feedback from @ryanlecompte

  • Loading branch information...
commit 130c22e1594bc8b044391455bcd05a77966f6f7b 1 parent b6fe72f
@mperham authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/girl_friday.rb
View
12 lib/girl_friday.rb
@@ -18,21 +18,21 @@
module GirlFriday
@@lock = Mutex.new
- @@queues = []
def self.add_queue(ref)
@@lock.synchronize do
- @@queues = @@queues.keep_if { |q| q.weakref_alive? }
- @@queues << ref
+ @queues ||= []
+ @queues.keep_if { |q| q.weakref_alive? }
+ @queues << ref
end
end
def self.queues
- @@queues
+ @queues || []
end
def self.status
- queues.keep_if { |q| q.weakref_alive? }.inject({}) { |memo, queue| queue.weakref_alive? ? memo.merge(queue.__getobj__.status) : memo }
+ queues.inject({}) { |memo, queue| queue.weakref_alive? ? memo.merge(queue.__getobj__.status) : memo }
end
##
@@ -44,7 +44,7 @@ def self.status
# Note that shutdown! just works with existing queues. If you create a
# new queue, it will act as normal.
def self.shutdown!(timeout=30)
- qs = queues.delete_if { |q| !q.weakref_alive? }
+ qs = queues.select { |q| q.weakref_alive? }
count = qs.size
if count > 0
Please sign in to comment.
Something went wrong with that request. Please try again.