You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My workers will restart on file changes in development to reload the used resource inside the worker.
It looks like the onStop won't get triggered.
To overcome this, I created a command which I can use to clear the workers.
It looks like this:
$onChange = debounce(staticfunction () {
run('docker compose stop xxx_worker');
run ('docker compose exec xxx php bin/console messenger:monitor:purge:worker'); // Custom command as workaroundrun ('docker compose exec xxx php bin/console messenger:monitor:purge --older-than all'); // to only see new messages after reloadrun('docker compose start xxx_worker');
}, 5000);
#[AsCommand(
name: 'messenger:monitor:purge:worker',
description: 'Remove all worker ids from the cache.',
)]
classMessengerMonitorPurgeWorkerCommandextendsCommand
{
publicfunction__construct(
private readonly CacheInterface$cache
)
{
parent::__construct();
}
protectedfunctionexecute(InputInterface$input, OutputInterface$output): int
{
$item = $this->cache->getItem("zenstruck_messenger_monitor.worker_ids");
$item->set([]);
$this->cache->save($item);
returnCommand::SUCCESS;
}
}
So basically, it would be nice to have a command for that like mine or any other solution to automatically remove workers which aren't really running.
The command works in my case, but I am sure in other cases, without restarting the workers, they won't register themselves again.
The text was updated successfully, but these errors were encountered:
Hey @Chris53897, I might wasn't explicit enough. I especially talking about the scenario in which the WorkerStoppedEvent won't get called.
In my case the xxx_worker service container is just a simple php bin/console messenger:consume async -vv. But to be explicit, in my cases the event won't get called as the service will be killed a lot in development, which results in the lose cache objects.
Hey nice bundle.
My workers will restart on file changes in development to reload the used resource inside the worker.
It looks like the onStop won't get triggered.
To overcome this, I created a command which I can use to clear the workers.
It looks like this:
So basically, it would be nice to have a command for that like mine or any other solution to automatically remove workers which aren't really running.
The command works in my case, but I am sure in other cases, without restarting the workers, they won't register themselves again.
The text was updated successfully, but these errors were encountered: