99
1010import asyncio
1111import weakref
12- from asyncio import (
13- CancelledError ,
14- Event ,
15- Task ,
16- )
12+ from asyncio import CancelledError , Event , Task
1713from typing import Awaitable , Callable , Union
1814
19-
2015from rich .repr import Result , rich_repr
2116
22- from . import events
17+ from . import _clock , events
2318from ._callback import invoke
2419from ._context import active_app
25- from . import _clock
26- from ._types import MessageTarget
2720from ._time import sleep
21+ from ._types import MessageTarget
2822
2923TimerCallback = Union [Callable [[], Awaitable [None ]], Callable [[], None ]]
3024
@@ -142,7 +136,7 @@ async def _run(self) -> None:
142136 _interval = self ._interval
143137 await self ._active .wait ()
144138 start = _clock .get_time_no_wait ()
145- sleep_event = Event ()
139+
146140 while _repeat is None or count <= _repeat :
147141 next_timer = start + ((count + 1 ) * _interval )
148142 now = await _clock .get_time ()
@@ -151,9 +145,8 @@ async def _run(self) -> None:
151145 continue
152146 now = await _clock .get_time ()
153147 wait_time = max (0 , next_timer - now )
154- if wait_time > 1 / 1000 :
155- await sleep (wait_time )
156-
148+ if wait_time > 1 / 1000 :
149+ await sleep (wait_time )
157150
158151 count += 1
159152 await self ._active .wait ()
0 commit comments