lib/sidekiq/limit_fetch/global/semaphore.rb in sidekiq-limit_fetch-1.6 vs lib/sidekiq/limit_fetch/global/semaphore.rb in sidekiq-limit_fetch-1.7
- old
+ new
@@ -21,14 +21,26 @@
def acquire
Selector.acquire([@name]).size > 0
end
def release
- Selector.release [@name]
+ redis {|it| it.lrem "#{PREFIX}:probed:#@name", 1, Selector.uuid }
end
def busy
redis {|it| it.llen "#{PREFIX}:busy:#@name" }
+ end
+
+ def increase_busy
+ redis {|it| it.rpush "#{PREFIX}:busy:#@name", Selector.uuid }
+ end
+
+ def decrease_busy
+ redis {|it| it.lrem "#{PREFIX}:busy:#@name", 1, Selector.uuid }
+ end
+
+ def probed
+ redis {|it| it.llen "#{PREFIX}:probed:#@name" }
end
def pause
redis {|it| it.set "#{PREFIX}:pause:#@name", true }
end