revert timer change (#2417)

* revert timer change

* changelog
This commit is contained in:
Will McGugan
2023-04-28 11:47:28 +01:00
committed by GitHub
parent 7c696ce378
commit 16a1645671
2 changed files with 6 additions and 4 deletions

View File

@@ -9,8 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Fixed timer issue https://github.com/Textualize/textual/issues/2416
- Fixed `textual run` issue https://github.com/Textualize/textual/issues/2391
## [0.22.0] - 2023-04-27
### Fixed

View File

@@ -131,16 +131,16 @@ class Timer:
wait_time = max(0, next_timer - now)
await sleep(wait_time)
count += 1
try:
await self._tick(next_timer=next_timer, count=count)
except EventTargetGone:
break
await self._active.wait()
if self._reset:
start = _time.get_time()
count = 0
self._reset = False
continue
try:
await self._tick(next_timer=next_timer, count=count)
except EventTargetGone:
break
async def _tick(self, *, next_timer: float, count: int) -> None:
"""Triggers the Timer's action: either call its callback, or sends an event to its target"""