diff --git a/src/async-queue/src/Driver/Driver.php b/src/async-queue/src/Driver/Driver.php index 60122d40f..69aa04cb3 100644 --- a/src/async-queue/src/Driver/Driver.php +++ b/src/async-queue/src/Driver/Driver.php @@ -112,7 +112,7 @@ abstract class Driver implements DriverInterface { $info = $this->info(); foreach ($info as $key => $value) { - $this->event && $this->event->dispatch(new QueueLength($key, $value)); + $this->event && $this->event->dispatch(new QueueLength($this, $key, $value)); } } diff --git a/src/async-queue/src/Event/QueueLength.php b/src/async-queue/src/Event/QueueLength.php index d8b52a2a5..9b74ea516 100644 --- a/src/async-queue/src/Event/QueueLength.php +++ b/src/async-queue/src/Event/QueueLength.php @@ -12,8 +12,15 @@ declare(strict_types=1); namespace Hyperf\AsyncQueue\Event; +use Hyperf\AsyncQueue\Driver\DriverInterface; + class QueueLength { + /** + * @var DriverInterface + */ + public $driver; + /** * @var string */ @@ -24,8 +31,9 @@ class QueueLength */ public $length; - public function __construct(string $key, int $length) + public function __construct(DriverInterface $driver, string $key, int $length) { + $this->driver = $driver; $this->key = $key; $this->length = $length; }