Skip to content

Will intervals be added?Β #348

@kanewi11

Description

@kanewi11

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions