feat: Add HTTP server, remove unhealthy thread monitoring in favour of logging#25
feat: Add HTTP server, remove unhealthy thread monitoring in favour of logging#25
Conversation
| @@ -1,17 +0,0 @@ | |||
| import logging | |||
There was a problem hiding this comment.
Maybe there's something I'm not considering, but do we need to delete this file? Could we not keep it and maybe add some warning logs saying that it's deprecated, and you should use the health endpoints directly instead?
That way we can avoid introducing this only for backwards compatibility in the API's manage.py. There might also be some subtle changes in behaviour which I'm not considering, and I'd rather keep this as unchanged as possible if it's for backwards compatibility.
There was a problem hiding this comment.
That way we can avoid introducing this only for backwards compatibility
The problem with this command is the fact it's run via Django's management command framework, triggering ready and post migrate signals we cannot control (or, at the very least, have to control, which is an overkill for something like a healthcheck). This is why we need to intercept it earlier than the moment Django kicks in, and it's also why an empty/lightweight command wouldn't be a sufficient solution.
I'd rather keep this as unchanged as possible if it's for backwards compatibility.
I'd agree here, but the check is causing problems in some of the production environments right now. We discussed leaving current health logic with @gagantrivedi, but he mentioned that it's not in fact correct (see https://flagsmith.slack.com/archives/CTF0THS2D/p1740484073370499?thread_ts=1740480199.053439&cid=CTF0THS2D).
TL/DR: the check is too broken to be left as is.
ef765ed to
59af2ba
Compare
59af2ba to
43387cb
Compare
|
In 43387cb, I refactored the task processor main thread to a thread of its own in order to be able to run a Gunicorn server in the main thread instead. This allows to serve HTTP endpoints, which HTTP healtchecks require, and is also important for the upcoming Prometheus endpoint. |
This PR adds a Gunicorn server to the
runprocessorcommand.Additionally, it removes the
checktaskprocessorthreadhealthmanagement command and related code. Threads deemed "unhealthy" are now simply logged to stdout under WARNING level.