Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Make Server class octoprint_daemon-aware, make sure terminated() gets… #1330
What does this PR do and why is it necessary?
This PR is for cleaning up the pidfile of a daemonized instance upon termination. This is my proposed solution to address issue #1324
How was it tested? How can it be tested by the reviewer?
What are the relevant tickets if any?
Screenshots (if appropriate)
This seems like the necessary solution for this case. The Server class handles clean-up and termination, so it seems to make the most sense to make it octoprint_daemon-aware and force a clean-up of the Daemon instance. The exit() is no longer needed, as the termination should otherwise be handled as it normally is (now).
This was previously created as #1328, but this iteration addresses the concern by @foosel that we should be cleaning up the pidfile later on in termination. This iteration moves the octoprint daemon cleanup to on_shutdown() instead, just before printing 'Goodbye!', and mentions in the log that it's cleaning up the pidfile. This does mean that we're no longer cleaning up the pidfile strictly on SIGTERM, but that's probably okay because if _octoprint_daemon is not None then we really need to clean up after it if we can.
Oooo, thanks! =)
Looks like it was a pretty straightforward backport -- just needs the two self._logConf and self parameters added to https://github.com/foosel/OctoPrint/blob/maintenance/src/octoprint/__init__.py#L27 =)