Skip to content

Commit 94cd455

Browse files
committed
touch() throws an error on nil delta
Fixed README (now touch(0) or touch(nil) are both noop) closes gh-57
1 parent 32f0a7a commit 94cd455

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,8 @@ time needed to work on task.
385385

386386
Effect: the value of `ttr` and `ttl` increased by `increment` seconds. If queue
387387
does not support ttr, error will be thrown. If `increment` is lower than zero,
388-
error will be thrown. If `increment` is zero effect is no op. If `increment` is
389-
`nil` it will be equal to current `ttr` of task. If current `ttr` of task is
390-
500 years or greater then operation is noop.
388+
error will be thrown. If `increment` is zero or nil effect is noop. If current
389+
`ttr` of task is 500 years or greater then operation is noop.
391390

392391
Example: t_value = queue.tube.list_of_sites:touch(15, 60)
393392

queue/abstract.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ function tube.take(self, timeout)
9999
end
100100

101101
function tube.touch(self, id, delta)
102+
if delta == nil then
103+
return
104+
end
102105
if delta < 0 then -- if delta is lesser then 0, then it's zero
103106
delta = 0
104107
elseif delta > MAX_TIMEOUT then -- no ttl/ttr for this task

0 commit comments

Comments
 (0)