queue icon indicating copy to clipboard operation
queue copied to clipboard

Bug with "limfifottl" queues when capacity is reached

Open PavelFil opened this issue 3 years ago • 0 comments

Create a queue

queue = require 'queue'
queue.create_tube('test', 'limfifottl', {capacity = 1})

Next add records:

$queue = new Queue($client, 'test');
$result = $queue->put(45);
var_dump($result);
$result = $queue->put(45);
var_dump($result);

Output:

object(Tarantool\Queue\Task)#26 (3) {
  ["id":"Tarantool\Queue\Task":private]=>
  int(0)
  ["state":"Tarantool\Queue\Task":private]=>
  string(1) "r"
  ["data":"Tarantool\Queue\Task":private]=>
  int(45)
}
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Tarantool\Queue\Task::fromTuple() must be of the type array, null given, called in /vendor/tarantool/queue/src/Queue.php on line 45 and defined in /vendor/tarantool/queue/src/Task.php:34
Stack trace:
#0 /vendor/tarantool/queue/src/Queue.php(45): Tarantool\Queue\Task::fromTuple(NULL)
#1 /test.php(60): Tarantool\Queue\Queue->put(45)
#2 {main}
  thrown in /vendor/tarantool/queue/src/Task.php on line 34

Expected output:

object(Tarantool\Queue\Task)#26 (3) {
  ["id":"Tarantool\Queue\Task":private]=>
  int(0)
  ["state":"Tarantool\Queue\Task":private]=>
  string(1) "r"
  ["data":"Tarantool\Queue\Task":private]=>
  int(45)
}
NULL

PavelFil avatar Oct 20 '22 07:10 PavelFil