Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
feat: Added logging for time consumed while processing webhooks (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevforget authored Jan 4, 2022
1 parent e4ddf70 commit 1e02dd1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tapiriik/web/views/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit 1e02dd1

Please sign in to comment.