Skip to content

Commit

Permalink
Fix health check restarts
Browse files Browse the repository at this point in the history
Completely removes the celery part of our health check to fix an issue where Celery being slow was causing a restart loop.
  • Loading branch information
kitsuta committed Nov 1, 2024
1 parent 3e8bbb7 commit 1c2814f
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions uber/site_sections/devtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,24 +242,10 @@ def health(self, session):
session.execute(text('SELECT 1'))
db_read_time += time.perf_counter()

if os.environ.get("ENABLE_CELERY", "true").lower() == "true":
payload = random.randrange(1024)
task_run_time = -time.perf_counter()
response = ping.delay(payload).wait(timeout=2)
task_run_time += time.perf_counter()
else:
task_run_time = 0
payload = "Not Run, ENABLE_CELERY != true"
response = "Not Run, ENABLE_CELERY != true"

return json.dumps({
'server_current_timestamp': int(datetime.utcnow().timestamp()),
'session_read_count': read_count,
'session_commit_time': session_commit_time,
'db_read_time': db_read_time,
'db_status': Session.engine.pool.status(),
'task_run_time': task_run_time,
'task_response_correct': payload == response,
'task_payload': payload,
'task_response': response,
})

0 comments on commit 1c2814f

Please sign in to comment.