Skip to content

Commit

Permalink
Only storing ping results
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed May 17, 2023
1 parent 6034e00 commit 46044c7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions uber/site_sections/devtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,21 @@ def health(self, session):
session.execute(text('SELECT 1'))
db_read_time += time.perf_counter()

#payload = random.randrange(1024)
#task_run_time = -time.perf_counter()
#response = ping.delay(payload).wait()
#task_run_time += time.perf_counter()
payload = random.randrange(1024)
task_run_time = -time.perf_counter()
response = ping.delay(payload).wait()
task_run_time += time.perf_counter()

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,
'task_run_time': task_run_time,
'task_response_correct': payload == response,
'task_payload': payload,
'task_response': response,
})

@register_diagnostics_status_function
Expand Down
3 changes: 2 additions & 1 deletion uber/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
celery.conf.beat_startup_tasks = []
celery.conf.update(config_dict['celery'])
celery.conf.update(broker_url=config_dict['secret']['broker_url'])
celery.conf.update(result_backend="rpc")
celery.conf.update(result_backend=config_dict['secret']['broker_url'].replace("amqp://", "rpc://"))
celery.conf.update(task_ignore_result=True)

def celery_on_startup(fn, *args, **kwargs):
celery.conf.beat_startup_tasks.append((celery.task(fn), args, kwargs))
Expand Down
2 changes: 1 addition & 1 deletion uber/tasks/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from uber.models import Session
from sqlalchemy import text

@celery.task
@celery.task(ignore_result=False)
def ping(response):
with Session() as session:
session.execute(text('SELECT 1'))
Expand Down

0 comments on commit 46044c7

Please sign in to comment.