File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
src/Jenssegers/Mongodb/Queue Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -101,8 +101,8 @@ protected function releaseJobsThatHaveBeenReservedTooLong($queue)
101101
102102 $ reserved = $ this ->database ->collection ($ this ->table )
103103 ->where ('queue ' , $ this ->getQueue ($ queue ))
104- ->whereNotNull ('reserved_at ' );
105- ->where ('reserved_at ' , '<= ' , $ expiration );
104+ ->whereNotNull ('reserved_at ' )
105+ ->where ('reserved_at ' , '<= ' , $ expiration )
106106 ->get ();
107107
108108 foreach ($ reserved as $ job ) {
Original file line number Diff line number Diff line change @@ -63,4 +63,20 @@ public function testFindFailJobNull(): void
6363
6464 $ this ->assertNull ($ provider ->find (1 ));
6565 }
66+
67+ public function testIncrementAttempts (): void
68+ {
69+ Queue::push ('test1 ' , ['action ' => 'QueueJobExpired ' ], 'test ' );
70+ Queue::push ('test2 ' , ['action ' => 'QueueJobExpired ' ], 'test ' );
71+
72+ $ job = Queue::pop ('test ' );
73+
74+ $ jobs = Queue::getDatabase ()
75+ ->table (Config::get ('queue.connections.database.table ' ))
76+ ->get ();
77+
78+ $ this ->assertEquals (1 , $ jobs [0 ]['attempts ' ]);
79+ $ this ->assertEquals (1 , $ jobs [0 ]['reserved ' ]);
80+ $ this ->assertEquals (0 , $ jobs [1 ]['attempts ' ]);
81+ }
6682}
You can’t perform that action at this time.
0 commit comments