zidoro / pomatez

Stay Focused. Take a Break.
https://zidoro.github.io/pomatez/
MIT License
4.07k stars 171 forks source link

timer slower in background in tauri version #608

Closed Inori-Lover closed 2 months ago

Inori-Lover commented 9 months ago

Describe the bug when choose tauri version, after hidden the main window, the clock become much slower then real time.

To Reproduce

  1. start the tauri version pomatez
  2. mark the time, close to tray
  3. after about 10 minutes
  4. open the main, compare time

Expected behavior time go as fast as system clock

Desktop (please complete the following information):

Additional context similar issue: https://github.com/zidoro/pomatez/issues/67 seem related issue: https://github.com/tauri-apps/tauri/issues/5250

sekwah41 commented 9 months ago

I need to rework the timer code anyway to support a mobile version, Though currently the code has a timer triggering every 1 second. When the browser goes into the background it tends to slow the number of functions that can trigger in the background. I am assuming this is going above the 1 second hence slowing this down. I am not sure when I will have time to address this properly, though I can take a look at making it validate the time remaining based on a start time rather than time remaining.

Inori-Lover commented 9 months ago

@sekwah41 thanks for quick response! it sound like a good work

Inori-Lover commented 9 months ago

sorry for the wrong operate.

sekwah41 commented 5 months ago

Making this a high priority now as it majorly causes an issue for the reliability

sekwah41 commented 2 months ago

I added some additional logic and tested it now to sync the countdown with the timer as well as try to re-align the ticking interval to be as close to the second as possible so when it is maximised, it should re-align asap and avoid potentially skipping a second visually every now and then.

sekwah41 commented 2 months ago

I not only minimised it in the background but also put the laptop to sleep for a few mins and it seems to be fine :D

Screenshot 2024-08-30 at 4 04 15 PM