tarantool / queue

Create task queues, add and take jobs, monitor failed tasks
Other
236 stars 52 forks source link

Tasks ttl and ttr wrong behavior #146

Open HejVkt opened 3 years ago

HejVkt commented 3 years ago

When we put a task with ttl and ttr set, it behaves incorrectly.

Example:
queue = require 'queue'
queue.create_tube('test_ttr', 'fifottl')
queue.tube.test_ttr:put('foobar', {ttr=100, ttl=5})
queue.tube.test_ttr:take(0)

----- Wait six seconds
queue.tube.test_ttr:ack(0)
- error: Task was not taken in the session

I think this behavior is due to the fact that the task was removed from the queue after ttl = 5 seconds. But in my opinion, when the task was taken, it should has a new ttl in the queue = remaining time + ttr

Something like that 3+100 and it should ack() correctly without error within 103 seconds

LeonidVas commented 3 years ago

Yep. The bug in fifottl driver. This can also be seen from the state diagram of the task.