Giter Site home page Giter Site logo

Comments (4)

andrewgodwin avatar andrewgodwin commented on June 12, 2024

No, they can be coroutines, as something in the framework or application could explicitly await on them periodically to drive them forward. They are relatively likely to be tasks, but they do not strictly have to be, as far as I am aware.

from asgiref.

Hawk777 avatar Hawk777 commented on June 12, 2024

If they’re not a task, something has to await them for them to run. As far as I can tell, the only tasks that the ASGI server promises to create are one for the lifespan protocol and one for each request. If any of those things is awaiting another coroutine, then that coroutine is living within the lifetime of that other task, and so cannot be killed by the ASGI server itself (because the ASGI server doesn’t even know it exists, it only runs when the task in question drives it).

What else is there that could await them?

from asgiref.

andrewgodwin avatar andrewgodwin commented on June 12, 2024

You can, for example, use event_loop.call_later in order to have something run at some future time without a Task.

from asgiref.

Hawk777 avatar Hawk777 commented on June 12, 2024

Ah, I guess you could call_later(the_coroutine.send) or something like that (since call_later itself doesn’t take a coroutine but just a normal function). I guess that makes sense, though I still find the wording a little bit confusing.

from asgiref.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.