python-pause
python-pause copied to clipboard
After computer standby, pause unnecessarily sleeps for up to half of the specified time
The documentation says:
On the other hand, with pause.seconds(3600), if your computer goes into standby mode for several hours, the program will continue immediately after the machine wakes back up since the minimum amount of time has passed since the pause was started.
With to the "logarithmic sleeping" implemented in #8, time.sleep()
is initially called with half the specified time interval. When the computer goes to standby then, it will still sleep for that time after walking up.
A good middle ground would probably be to limit the "logarithmic" sleep interval to one minute or so.
The same applies if the user changes the time in their system clock: instead of noticing straight away, it will take up until half of the original wait time.
As far as I can see, these two eventualities are the original use cases for this module: if they didn't happen then you could just compute the time difference and done a normal sleep. So that change has completely broken this package.
I would say that the most reasonable implementation is the one that had already existed before that pull request i.e. always sleep for 1 second regardless of how long is left.