Repository navigation
Conversation
Currently suspend detection does not work on Linux, as go's time.Since() compares monotonic time, instead of wall time, which is halted during suspend.
|
Please change the title to "cmd/syncthing: Fix restarting after system suspend (fixes #8341)". |
| func standbyMonitor(app *syncthing.App, cfg config.Wrapper) { | ||
| restartDelay := 60 * time.Second | ||
| now := time.Now() | ||
| now := time.Now().Round(0) |
There was a problem hiding this comment.
Could you please add a comment explaining that rounding ensures wall time is used. Or make a tiny wallTimeNow utility method, such that the name is hte explanation.
|
I have a different suggestion. Monotonic time was introduced in Go 1.9 in 2017, five years ago. This apparently hasn't worked since then, and essentially nobody has noticed or complained. We should just remove the whole concept. |
Assuming you mean to remove the whole restart-on-wakeup feature I'd agree: I disable it as standard on every Syncthing install I manage, because of the resource drain it can cause, which is compounded by Every Other Thing doing CPU/IO when a machine is resumed. |
|
Yes. The original issue that this fixes has been re-targeted to be about improved STUN behavior as well, which is the real issue here. |
|
"Fixed" by #8449 |
Currently suspend detection does not work on Linux, as go's time.Since()
compares monotonic time, instead of wall time, which is halted during suspend.
This fixes the issue.