Restarts were frequent
- Cause.
- Workers restart after a request limit, and health checks counted toward it. About 95% of requests were health checks.
- Fix.
- A pre_request hook gives each health check back, so it nets to zero. Seven lines and a test against a real SyncWorker.
def pre_request(worker, req):if req.path == HEALTH_CHECK_PATH:worker.nr -= 1 # probes don't age the worker







