events daemon dies easily
MareoRaft opened this issue · 9 comments
After some time, the events daemon will die from a "broken pipe".
It could be that one of the connections within the application terminates. Like if the mongo cursor terminates, we can just create a new cursor each time we want to access db. If the google service terminates, we can just create a new service each time we want to access db. But I'm not sure the cause of the broken pipe.
branch daemon
to troubleshoot this. First I'll try getting a new google service.
Troubleshoot. First try to reproduce error:
daemon started 9:57 am...
The stacktrace says the final function in MY code is
service.events().list(...params...).execute()
So I think the google service loses connection.
I'll try to create a new google service each time...
I am now running the 'daemon' branch on the server. So if the daemon is still running on Tuesday Sept 18, we can merge this into master and consider the problem resolved.
nope. it broke again. On Sept 16, 1:48 pm....
Traceback (most recent call last):
File "./events_daemon.py", line 25, in <module>
main()
File "./events_daemon.py", line 20, in main
get_events_and_update_db()
File "./events_daemon.py", line 13, in get_events_and_update_db
(events, datetime_retrieved) = get_events(get_service(), cal_names=CAL_NAMES)
File "/usr/home/freebsd/schedule/server-side/main.py", line 36, in get_events
orderBy='startTime'
File "/usr/local/lib/python3.6/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/googleapiclient/http.py", line 840, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 503 when requesting https://www.googleapis.com/calendar/v3/calendars/gtbqdl9o6cpntqvlgnjbr6k00c%40group.calendar.google.com/events?timeMin=2018-09-16T17%3A53%3A29.499270Z&maxResults=200&singleEvents=true&orderBy=startTime&alt=json returned "Backend Error">
Now I changed it so that it's in a try
block, so it will just keep trying again, even if it errors. Now we wait another 4 days to see if this works. Until Saturday, Sept. 22.
This seems to be working!