Skip to content

Commit 2d03847

Browse files
Fix push() to working afterCommit() (#81)
* Fix push() for working afterCommit() * Fix test
1 parent 9b9a832 commit 2d03847

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/PubSubQueue.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,15 @@ public function push($job, $data = '', $queue = null)
9999
$options['orderingKey'] = $job->orderingKey;
100100
}
101101

102-
return $this->pushRaw($this->createPayload($job, $this->getQueue($queue), $data), $queue, $options);
102+
return $this->enqueueUsing(
103+
$job,
104+
$this->createPayload($job, $this->getQueue($queue), $data),
105+
$queue,
106+
null,
107+
function ($payload, $queue) use ($options) {
108+
return $this->pushRaw($payload, $queue, $options);
109+
}
110+
);
103111
}
104112

105113
/**

tests/Unit/PubSubQueueTests.php

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public function testPushNewJob(): void
7676
$job = 'test';
7777
$data = ['foo' => 'bar'];
7878

79+
$this->queue->setContainer(Container::getInstance());
80+
7981
$this->queue->expects($this->once())
8082
->method('pushRaw')
8183
->willReturn($this->expectedResult)

0 commit comments

Comments
 (0)