Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
A.Shpak committed Apr 2, 2024
1 parent a1082ed commit 21f278b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions chatushka/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from collections.abc import AsyncGenerator, MutableMapping, Sequence
from contextlib import AbstractAsyncContextManager, asynccontextmanager
from datetime import timezone, tzinfo
from functools import partial
from traceback import print_exception

import aiocron # type: ignore
Expand Down Expand Up @@ -59,6 +58,7 @@ async def _call_scheduled(
self,
func,
):
logger.info(f"{self} ::: scheduled call of {func.__name__}")
async with self._make_api_client() as client:
await func(
api=client,
Expand All @@ -72,12 +72,7 @@ def schedule(
def _wrapper(
func,
):
job = aiocron.Cron(
cron,
func=partial(self._call_scheduled, func=func),
start=False,
tz=tz,
)
job = aiocron.Cron(cron, self._call_scheduled, start=False, tz=tz, args=func)
logger.info(f"{self} + {job}")
self._schedulers.append(job)

Expand Down

0 comments on commit 21f278b

Please sign in to comment.