Timed events and their outcome (messages)

I love that django turns more and more ASGI, but over multiple projects already I struggle with two very common problems, I would wish for a real django-internal solution.

timed / reoccuring events
I usually try to do this with the old django-background-tasks package - it is not maintained any more, but someone forked it to bring it to django 4.0. It is a pity, this is not an included functionality. Going full celery seems a bit overpowered to me usually.

async messaging
Does not weather if in admin or in a normal view - If I create an async task, I want to be able to inform the user of its status / outcome. There was an old async-messages package for django, but it never made it to python 3 IIRC.

I would not only like to know how other devs solve these (probably very regularly occurring) problems, but also if there are some packages that can take care of this, that I missed so far …

I’m not sure why you would consider this necessary or even desirable.

If the only requirement is “timed / recurring events”, then yes - celery is overkill. You can get by with cron or any other system-layer scheduler for that type of task. There’s no need or value to try and add this into the request / response cycle of Django.

You’ve got options here. The “simple” way to handle this is have your background tasks write your results to a model. You can then implement a “long-poll” or “short-poll” solution in the browser to wait for responses.

If you need something more direct, then you’re looking at a websockets / SSE style connection, for which you can either use Channels or something outside of the Django environment completely such as NodeJS. But in any event, again, these types of connections are outside Django’s core request / response model.

(Side note: Personally, I prefer the word “requirement” rather than “problem” here as they are all solved issues.)

Because we use Celery for request-driven tasks, it’s natural for us to add Celery Beats for the scheduled tasks.

For the “out-of-band” notifications, most of our needs (as limited as they are) are satisfied by a long-poll solution. However, we do have a couple of projects using websockets / Channels.