Our investigation found two distinct issues:
The first has to do with push notifications received from Office 365 that contain instructions that Teem should renew our subscription. These unique push notifications would trigger Teem to start a new subscription to changes on the calendar folder. However, it was found that Office 365 would repeatedly send these push notifications and that in certain cases this could create a race condition where the subscription saved to Office 365 was different than that saved in Teem. To remediate this, we have implemented a scheduling system for calendar jobs that lets Teem react after a short time to the first of these unique push notifications, and ignore any subsequent notifications. Monitoring has shown that this change is effective in renewing our calendar subscription and removing these race conditions.
The second issue had to do with normal errors that occur when working with Office 365. When Teem received these errors, after trying multiple times over the course of a few minutes, we would stop attempting to sync the calendar. While most calendars naturally recovered because of a subsequent calendar change, a subset of calendars would not have a later change, and thus stay out of sync. Our investigation showed that some of these errors were temporary. Using the scheduling system described above, we now isolate temporary errors and schedule a retry for a later time. This helps ensure that we can sync in the events as expected.