Skip to content

Commit

Permalink
Fixed writing setting telescope.recording error (#746)
Browse files Browse the repository at this point in the history
* Fixed writing setting `telescope.recording` error

* Optimized

---------

Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
guandeng and huangdijia authored Nov 22, 2024
1 parent dfcdc92 commit e6a6754
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Listener/FetchRecordingOnBootListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Hyperf\Contract\ContainerInterface;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Coordinator\Timer;
use Hyperf\Coroutine\Coroutine;
use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\Framework\Event\BootApplication;
use Hyperf\Framework\Event\MainWorkerStart;
Expand Down Expand Up @@ -54,9 +53,7 @@ public function listen(): array
public function process(object $event): void
{
if ($event instanceof BootApplication) {
Coroutine::create(function () {
$this->config->set('telescope.recording', (bool) $this->telescopeConfig->fetchRecording());
});
$this->config->set('telescope.recording', (bool) $this->telescopeConfig->fetchRecording());
return;
}

Expand All @@ -78,6 +75,9 @@ private function shareMessageToWorkers(PipeMessage $message): void
$workerCount = $swooleServer->setting['worker_num'] - 1;

for ($workerId = 0; $workerId <= $workerCount; ++$workerId) {
if ($workerId === $swooleServer->worker_id) {
continue;
}
$swooleServer->sendMessage($message, $workerId);
$this->logger->debug(sprintf('[Telescope] Let Worker.%s try to update telescope.recording as %s.', $workerId, $message->recording ? 'true' : 'false'));
}
Expand Down

0 comments on commit e6a6754

Please sign in to comment.