onnela-lab / beiwe-backend

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe backend code
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
64 stars 45 forks source link

Weekly schedules can fail to regenerate the next week of scheduled events #401

Open biblicabeebli opened 1 month ago

biblicabeebli commented 1 month ago

Under unknown circumstances it is possible for weekly schedules to fail to be generated after sending (and/or failing to send) a push notification.

We only have one known participant with this issue, this participant was an iOS test participant on our staging server. The cause of this is unknown, but presumably there is an unhandled error in the push notification logic - weekly notifications trigger their own generation of the next event, this seems brittle, we should change that.

1) Make a script that checks whether there are missing weekly ScheduledEvents for participants and run it on deployments to determine extent of the problem. 2) Make a periodic task that checks existing weekly ScheduledEvent, clears out ANCIENT (2 week old?) weekly ScheduledEvents, and populates any missing current or next-week++ weekly ScheduledEvents. 3) Junk the current brittle implementation.

biblicabeebli commented 1 month ago