Commit e68ca24b authored by Denisson Leal's avatar Denisson Leal

test for increment attempts only when taken from list

parent 4d3f45ef
......@@ -101,8 +101,8 @@ class MongoQueue extends DatabaseQueue
$reserved = $this->database->collection($this->table)
->where('queue', $this->getQueue($queue))
->whereNotNull('reserved_at');
->where('reserved_at', '<=', $expiration);
->whereNotNull('reserved_at')
->where('reserved_at', '<=', $expiration)
->get();
foreach ($reserved as $job) {
......
......@@ -63,4 +63,20 @@ class QueueTest extends TestCase
$this->assertNull($provider->find(1));
}
public function testIncrementAttempts(): void
{
Queue::push('test1', ['action' => 'QueueJobExpired'], 'test');
Queue::push('test2', ['action' => 'QueueJobExpired'], 'test');
$job = Queue::pop('test');
$jobs = Queue::getDatabase()
->table(Config::get('queue.connections.database.table'))
->get();
$this->assertEquals(1, $jobs[0]['attempts']);
$this->assertEquals(1, $jobs[0]['reserved']);
$this->assertEquals(0, $jobs[1]['attempts']);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment