Does PHP Laravel perform any cleanup when it get terminated by a terminate signal?
For example the following code:
class MyCommand extends Command
{
protected $signature = 'get:help';
protected $description = 'I need help';
public function handle()
{
pcntl_async_signals(true);
pcntl_signal(SIGTERM, [$this, "gracefullyShutdown"]);
pcntl_signal(SIGINT, [$this, "gracefullyShutdown"]);
// Do some task there.
}
public function gracefullyShutdown()
{
// Do I need to do any clean up?
//exit(0);
}
}
Because the terminate signal function got override, the handle()
continues running.
If I want to call exit(0)
in gracefullyShutdown()
do I need to release memory or do anything else before exit(0)
?
Or Can I call original terminate function like super.terminate()
or something? (super.terminate()
is psudo code)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire