Closed a-kbv closed 4 months ago
This code is enough:
$API = new API('session.madeline');
$API->restart();
Note that the event handler must be running in order for this code to work; it must also be wrapped in a bash while :; loop, as a restart will completely exit the script.
Restarting from within the event handler is also possible by using the RestartPlugin, which will offer a /restart command (that automatically invokes $this->restart()) to admins of the bot.
Hello danog,
I hope this message finds you well. I have been using the MadelineProto library extensively in my project and I want to start by saying thank you for creating such a powerful and useful tool. It has been instrumental in the development of my application.
Description of the Issue
I am currently running the MadelineProto event handler as part of a service within a Symfony-based application. The event handler is initiated via a Symfony command. My challenge arises when I implement modifications to the event handler code. I have a CI/CD pipeline in place that deploys changes to the server where the event handler needs to be restarted to load the new changes.
To ensure a seamless deployment process, I am looking for a way to gracefully shut down the running MadelineProto event handler via a Symfony command (or any other viable method) before starting it again. The goal is to have minimal disruption to the service while making sure that all events are properly handled during the restart.
Request for Assistance
Would it be possible for you to guide me on how to create or implement such a mechanism with MadelineProto? Is there an existing feature that allows for a graceful shutdown, or would this require a new feature to be added?
I believe that having a means to properly manage the shutdown process would be beneficial not just for my use case, but also for other developers who might be facing similar challenges.
I look forward to your response and any assistance you can provide. Thank you again for your continuous support of the MadelineProto community.
Best regards, akbv