phw198/OutlookGoogleCalendarSync

Delay immediate sync following system resume

Closed this issue · 7 comments

Is your feature request related to a problem? Please describe.
As per #1836 (comment), when a system resumes from suspend/hibernate, often OGCS can attempt to sync before the networking is available.

Describe the solution you'd like
For OGCS to detect the resume event and delay syncs to give the networking a chance to become usable.

@kuraikaze OGCS already detected a system time change, which is a side effect of resuming from suspend and logged at INFO with "Detected system timezone change" - so I think we can piggyback this.

📦 Delay by a minute should now happen with hotfix v2.10.4.5.zip (see instructions for applying).
      CRCs: Zip = 103B3E7D Exe = A53EF75B

Let me know how it goes.

Ah, 'k - that would explain why OGCS only displayed the error behaviour if the system had slept for more than one hour.
Hotfix applied - I'll let you know in an hour or two how it went :)

Nearly there ...

Got an OGCS popup with a different error this time:-

Calendar Folders.
A problem was encountered when searching for Outlook calendar folders.
COM object that has been separated from its underlying RCW cannot be used.

Then the same Windows Notification error triggered:-

OutookGoogleCalendarSync

Outook Google Calendar Sync
Issue encountered.
Please review the output on the main `Sync` tab"

However - a successful sync triggered 60 seconds afterwards, so that bit worked nicely. 👍

Of course I forgot to turn back on detailed logging when I applied the hotfix sigh
Logging set now - I'll gist a debug log once I have one that says anything worthwhile.

Hrmmm - no OGCS popup on next sleep/resume cycle, but a Windows Notification "Issue encountered" was triggered.

The time zone change was detected and the next sync scheduled for 60 seconds later.
However ... OGCS started a sync attempt immediately, which failed.
Then the schedule-delayed sync a minute later triggered and completed successfully.

Resume event is at 2024-04-28 17:36:15,244: OGcalsync.log 2.10.4.5-hotfix

I think the scheduled syncs are still firing too quickly before being able to get in and delay them.

📦 I taken a slightly different approach with hotfix v2.10.4.8.zip so please let me know how that goes (see instructions for applying).
      CRCs: Zip = 8C1B1432 Exe = 7675A4D0

This seems to work well for me - no popups or notifications generated, and sync completed successfully 60 seconds after resume event. Nice one 👍

2024-05-03 12:58:58,342 INFO  .NET SystemEvents OutlookGoogleCalendarSync.NotificationTray [49] -  Detected system timezone change.
2024-05-03 12:59:00,101 DEBUG  1 OutlookGoogleCalendarSync.Sync.SyncTimer [53] -  Scheduled sync triggered for profile: Default
2024-05-03 12:59:00,102 DEBUG  1 OutlookGoogleCalendarSync.Sync.SyncTimer [55] -  Too soon after system resume; delaying for 60 seconds...
2024-05-03 13:00:00,226 ULTRA-FINE  1 OutlookGoogleCalendarSync.Sync.PushSyncTimer [179] -  Push sync triggered.

Full OGcalsync.log uploaded for reference - Resume event at 024-05-03 12:58:58,342 : OGcalsync.log 2.10.4.8-hotfix

Perfect, that's great news! Thanks for confirming 👍🏻