cozy-labs / cozy-desktop

File Synchronisation for Cozy on Desktop and Laptop
https://cozy-labs.github.io/cozy-desktop/
GNU Affero General Public License v3.0
99 stars 45 forks source link

feat: React to power being suspended/resumed #2318

Closed taratatach closed 1 year ago

taratatach commented 1 year ago

Using Electron's power monitoring, we can make sure the watchers and the synchronization are stopped when the power is suspended and started again when the power is resumed.

This has 2 benefits:

  1. avoid delays to the power suspension (OSs try not to stop active processes)
  2. make sure event loops are reactivated when power is resumed as this seems to be an issue with Electron (see https://github.com/electron/electron/issues/4465)

The second point seems to be particularly true on macOS where we see the remote watcher stop working completely sometimes after a long suspension time.

Please make sure the following boxes are checked: