Skip to content

Commit 13ee3f1

Browse files
committed
Merge branch '5.6_database_queue_tsx_wrap' of https://github.com/ph4r05/framework into ph4r05-5.6_database_queue_tsx_wrap
2 parents fb814d3 + c38ee67 commit 13ee3f1

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/Illuminate/Queue/DatabaseQueue.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Illuminate\Queue;
44

5-
use Throwable;
65
use Illuminate\Support\Carbon;
76
use Illuminate\Database\Connection;
87
use Illuminate\Queue\Jobs\DatabaseJob;
@@ -191,19 +190,13 @@ public function pop($queue = null)
191190
{
192191
$queue = $this->getQueue($queue);
193192

194-
try {
195-
$this->database->beginTransaction();
196-
193+
return $this->database->transaction(function () use ($queue) {
197194
if ($job = $this->getNextAvailableJob($queue)) {
198195
return $this->marshalJob($queue, $job);
199196
}
200197

201-
$this->database->commit();
202-
} catch (Throwable $e) {
203-
$this->database->rollBack();
204-
205-
throw $e;
206-
}
198+
return null;
199+
});
207200
}
208201

209202
/**
@@ -267,8 +260,6 @@ protected function marshalJob($queue, $job)
267260
{
268261
$job = $this->markJobAsReserved($job);
269262

270-
$this->database->commit();
271-
272263
return new DatabaseJob(
273264
$this->container, $this, $job, $this->connectionName, $queue
274265
);

0 commit comments

Comments
 (0)