Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Nov 4, 2024
1 parent f767833 commit 44f2848
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/service-library/src/servicelib/background_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ async def _periodic_scheduled_task(
**task_kwargs,
) -> None:
# NOTE: This retries forever unless cancelled
nap = asyncio.sleep
if early_wake_up_event is not None:
nap = SleepUsingAsyncioEvent(early_wake_up_event)
nap = (
asyncio.sleep
if early_wake_up_event is None
else SleepUsingAsyncioEvent(early_wake_up_event)
)
async for attempt in AsyncRetrying(
sleep=nap,
wait=wait_fixed(interval.total_seconds()),
Expand Down

0 comments on commit 44f2848

Please sign in to comment.