﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34447	Support backgroup async repeat task. just like fastapi_utils.tasks.repeat_every	pythonwood	nobody	"
Feature Need: **Async django should make repeat task much more easy.**

I like to use fastapi_utils.tasks.repeat_every, so easy and doc is here:  
[https://fastapi-utils.davidmontague.xyz/user-guide/repeated-tasks/]



{{{
from fastapi import FastAPI
from sqlalchemy.orm import Session

from fastapi_utils.session import FastAPISessionMaker
from fastapi_utils.tasks import repeat_every

database_uri = f""sqlite:///./test.db?check_same_thread=False""
sessionmaker = FastAPISessionMaker(database_uri)

app = FastAPI()


def remove_expired_tokens(db: Session) -> None:
    """"""Pretend this function deletes expired tokens from the database""""""


@app.on_event(""startup"")
@repeat_every(seconds=60 * 60)  # 1 hour
def remove_expired_tokens_task() -> None:
    with sessionmaker.context_session() as db:
        remove_expired_tokens(db=db)
}}}


For Django, I found ''django-celery-beat and django-q and so on'', but they are too heavy for depending a sub-system which name broker.

I hope django support this feature when running in async mode. (ASGI Django) "	New feature	closed	Core (Other)	4.1	Normal	wontfix		wuweishun@…	Unreviewed	0	0	0	0	0	0
