8000 Fix · symfony/symfony@e04298b · GitHub
[go: up one dir, main page]

Skip to content

Commit e04298b

Browse files
Fix
1 parent e96f873 commit e04298b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Symfony/Component/Messenger/Middleware/LockMiddleware.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Messenger\Middleware;
1313

14+
use Symfony\Component\Lock\Key;
1415
use Symfony\Component\Lock\LockFactory;
1516
use Symfony\Component\Messenger\Envelope;
1617
use Symfony\Component\Messenger\Message\LockableMessageInterface;
@@ -39,9 +40,11 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
3940
if (null === $envelope->last(ReceivedStamp::class)) {
4041
if ($message instanceof LockableMessageInterface) {
4142
// If we're trying to dispatch a lockable message.
42-
$key = $message->getKey();
43+
$keyResource = $message->getKey();
44+
45+
if (null !== $keyResource) {
46+
$key = new Key($keyResource);
4347

44-
if (null !== $key) {
4548
// The acquire call must be done before stamping the message
4649
// in order to have the full state of the key in the stamp.
4750
$lock = $message instanceof TTLAwareLockableMessageInterface

0 commit comments

Comments
 (0)
0