diff --git a/src/Commands/WorkCommand.php b/src/Commands/WorkCommand.php index 28c2a01d..48242649 100644 --- a/src/Commands/WorkCommand.php +++ b/src/Commands/WorkCommand.php @@ -255,6 +255,7 @@ public function handlex(Redis $redis) // $allRequests = collect($redis->xrange('pulse_requests', '-', '+')); // dump($allRequests->keys()->first(), $allRequests->keys()->last(), $allRequests->count()); + return 0; } protected function getAggregates($from, $requests) diff --git a/src/Handlers/HttpRequestMiddleware.php b/src/Handlers/HttpRequestMiddleware.php index 9de777aa..7540bcbb 100644 --- a/src/Handlers/HttpRequestMiddleware.php +++ b/src/Handlers/HttpRequestMiddleware.php @@ -31,7 +31,7 @@ public function __invoke(callable $handler) rescue(fn () => $this->record($request, $startedAt, new CarbonImmutable), report: false); return $response; - }, function ($exception) { + }, function ($exception) use ($request, $startedAt) { rescue(fn () => $this->record($request, $startedAt, new CarbonImmutable), report: false); return new RejectedPromise($exception); diff --git a/src/Pulse.php b/src/Pulse.php index 454420a3..71748241 100644 --- a/src/Pulse.php +++ b/src/Pulse.php @@ -148,7 +148,7 @@ public static function auth(Closure $callback): static { static::$authUsing = $callback; - return new static; + return new self; } /** @@ -158,6 +158,6 @@ public static function ignoreMigrations(): static { static::$runsMigrations = false; - return new static; + return new self; } } diff --git a/tests/Feature/WorkCommandTest.php b/tests/Feature/WorkCommandTest.php index aa0e0da1..12375ee4 100644 --- a/tests/Feature/WorkCommandTest.php +++ b/tests/Feature/WorkCommandTest.php @@ -1,11 +1,13 @@ $startedAt->diffInMilliseconds(now()), - 'route' => 'GET /users', - 'user_id' => 5, - ]); + // RedisAdapter::xadd('pulse_requests', [ + // 'duration' => $startedAt->diffInMilliseconds(now()), + // 'route' => 'GET /users', + // 'user_id' => 5, + // ]); - expect(true)->toBeTrue(); -}); + // expect(true)->toBeTrue(); +})->todo();