briankaemingk / streaks-with-todoist

2 stars 0 forks source link

Reminder fired latency (~4 mins) #8

Closed briankaemingk closed 5 years ago

briankaemingk commented 5 years ago

Sometimes callbacks from JIT tasking/reminders are up to 4 minutes late. Looks like it is a delay in the callback send, as the latency response from the server logs is only about 17 seconds. Could investigate closure by adding server resource.

The below task was due and fired a reminder at 9am:

2018-12-05T17:03:40.165010+00:00 app[web.1]: 2018-12-05 09:03:40.163442-08:00: Reminder fired: FUW MA - Topo designs order
2018-12-05T17:03:40.173269+00:00 app[web.1]: Reminder - updating task from  Wed 05 Dec 2018 17:00:00 +0000  to  2018-12-05T23:59:59
2018-12-05T17:03:40.698973+00:00 heroku[router]: at=info method=POST path="/webhook_callback" host=streaks-with-todoist.herokuapp.com request_id=9e93f5c5-474e-4ec1-a7d0-439887ab6719 fwd="54.173.8.122" dyno=web.1 connect=0ms service=1767ms status=200 bytes=226 protocol=https
2018-12-05T17:03:40.704719+00:00 app[web.1]: 10.113.180.219 - - [05/Dec/2018:17:03:40 +0000] "POST /webhook_callback HTTP/1.1" 200 74 "-" "Todoist-Webhooks"
2018-12-05T17:03:41.745656+00:00 app[web.1]: 10.11.225.227 - - [05/Dec/2018:17:03:41 +0000] "POST /webhook_callback HTTP/1.1" 200 74 "-" "Todoist-Webhooks"
2018-12-05T17:03:41.743876+00:00 heroku[router]: at=info method=POST path="/webhook_callback" host=streaks-with-todoist.herokuapp.com request_id=879d2113-fbc2-48ee-a223-31d8181302c5 fwd="54.173.8.122" dyno=web.1 connect=1ms service=821ms status=200 bytes=226 protocol=https
briankaemingk commented 5 years ago

Reminder fired latency likely caused by the api call or database requests, currently processed sequentially. This was working when there was one user, but can cause request timeouts and doesn't scale.

Solution is to use background tasks such as python rq

briankaemingk commented 5 years ago

Closed by implementation of rq