Permalink
Browse files

Update pause/unpause based on Dan's feedback.

  • Loading branch information...
1 parent a22961f commit acf5fd9b677091a08a018a59b009959f32ca8d34 @myronmarston myronmarston committed Jan 7, 2013
Showing with 12 additions and 12 deletions.
  1. +6 −6 pause.lua
  2. +6 −6 unpause.lua
View
@@ -1,18 +1,18 @@
--- This script takes the name of the queue and adds it
+-- This script takes the name of the queue(s) and adds it
-- to the ql:paused_queues set.
--
--- Args:
--- 1) The queue to pause.
+-- Args: The list of queues to pause.
--
-- Note: long term, we have discussed adding a rate-limiting
-- feature to qless-core, which would be more flexible and
-- could be used for pausing (i.e. pause = set the rate to 0).
-- For now, this is far simpler, but we should rewrite this
-- in terms of the rate limiting feature if/when that is added.
+if #KEYS > 0 then error('Pause(): No Keys should be provided') end
+if #ARGV < 1 then error('Pause(): Must provide at least one queue to pause') end
+
local key = 'ql:paused_queues'
-for index, queue in ipairs(ARGV) do
- redis.call('sadd', key, queue)
-end
+redis.call('sadd', key, unpack(ARGV))
View
@@ -1,12 +1,12 @@
--- This script takes the name of the queue and removes it
+-- This script takes the name of the queue(s) and removes it
-- from the ql:paused_queues set.
--
--- Args:
--- 1) The queue to unpause.
+-- Args: The list of queues to pause.
+
+if #KEYS > 0 then error('Pause(): No Keys should be provided') end
+if #ARGV < 1 then error('Pause(): Must provide at least one queue to pause') end
local key = 'ql:paused_queues'
-for index, queue in ipairs(ARGV) do
- redis.call('srem', key, queue)
-end
+redis.call('srem', key, unpack(ARGV))

0 comments on commit acf5fd9

Please sign in to comment.