Giter Site home page Giter Site logo

Atomicity of handlers about xtra HOT 2 CLOSED

zesterer avatar zesterer commented on June 11, 2024
Atomicity of handlers

from xtra.

Comments (2)

zesterer avatar zesterer commented on June 11, 2024 1

Thanks, that clarifies things.

from xtra.

thomaseizinger avatar thomaseizinger commented on June 11, 2024

I am not too familiar with actix API but my thoughts on long-running handlers are:

  • If you have a long-running task, you should just spawn that into a runtime and send a message back to the actor once finished.
  • Be careful to not circumvent back-pressure this way. Spawning tasks is "unbounded" on pretty much all executors I think?
  • Tasks are not owned by an actor, meaning they will keep running even if the actor is shut down. Keep that in mind when you spawn tasks from handlers.

For IO, I'd typically spawn 1(!) task that reads from the IO source and immediately delegates to an actor, waiting for the handler to finish before reading the next message.

Does this help?

from xtra.

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.