From 1e02dd1e7245472ce61fa74f2bab3de262fc5bbd Mon Sep 17 00:00:00 2001 From: kevforget <74352754+kevforget@users.noreply.github.com> Date: Tue, 4 Jan 2022 16:17:17 +0100 Subject: [PATCH] feat: Added logging for time consumed while processing webhooks (#160) --- tapiriik/web/views/sync.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tapiriik/web/views/sync.py b/tapiriik/web/views/sync.py index 19c506e5..1c1a9623 100644 --- a/tapiriik/web/views/sync.py +++ b/tapiriik/web/views/sync.py @@ -98,8 +98,12 @@ def sync_clear_errorgroup(req, service, group): @csrf_exempt def sync_trigger_partial_sync_callback(req, service): + import logging + svc = Service.FromID(service) if req.method == "POST": + webhookBegining = datetime.now() + logging.info("WEBHOOK %s has send a webhook notification" % svc.ID) # We import the trigger handler mostly for strava rate limitations from sync_remote_triggers import trigger_remote @@ -135,6 +139,11 @@ def sync_trigger_partial_sync_callback(req, service): "message":"ok", "result":"0000" }) + + webhookEnd = datetime.now() + delta = webhookEnd - webhookBegining + logging.info("WEBHOOK %s - Ended processing of webhook in %f seconds" % (svc.ID, delta.total_seconds())) + return HttpResponse(status=svc.PartialSyncTriggerStatusCode) elif req.method == "GET":