Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will intervals be added? #348

Open
kanewi11 opened this issue Aug 17, 2024 · 0 comments
Open

Will intervals be added? #348

kanewi11 opened this issue Aug 17, 2024 · 0 comments

Comments

@kanewi11
Copy link

kanewi11 commented Aug 17, 2024

How can I implement launching tasks with an interval of less than one minute, for example 10 seconds?

This is necessary in order not to create:

while True:
    await asyncio.sleep(10)
    ...

And do not wrap it in try: ... except ExampleException: ..., so that the task does not crash and does not process the code anymore.

OR:

@broker.task(
    task_name="my_task",
    timeout=10,
)
async def my_task() -> None:
    await async_card_check_payments()


@broker.task(
    task_name="infinity my task",
)
async def infinity_my_task() -> None:
    while True:
        await my_task.kiq()
        await asyncio.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant