Giter Site home page Giter Site logo

Comments (3)

pron avatar pron commented on June 2, 2024

Those warnings are true, though: you really are blocking a thread. This is why we have pulsar.core/promise. What behavior would you like to see? The only solution, AFAICT, is to have that other library (manifold?) integrate Pulsar, so that, if running in a fiber, would only block the fiber.

from pulsar.

andreasthoelke avatar andreasthoelke commented on June 2, 2024

Ah thanks, it makes sense now. I guess I was somehow thinking that derefing even non-pulsar things in a fiber would still only block that fiber/Strand! So this warning is in fact super useful – I just overlooked that critical part β€œ..is blocking a thread” in the long string.
In any case I think I can just link Aleph/Manifold to Pulsar on the callback level, e.g.

(defn websocket-handler [request]
  (-> (aleph.http/websocket-connection request)
      (manifold.deferred/on-realized (fn [user-socket]
                                       (,,,)))))

it will just not be as smooth. Will explore this a bit further and potentially propose an integration at the Manifold repo.

from pulsar.

pron avatar pron commented on June 2, 2024

I should note that it's trivial to transform an asynchronous API to a fiber-blocking one using await. Transforming a thread-blocking API to a fiber-blocking one requires a more work, and usually the cooperation of the library's author.

When integrating third-party libraries, you then have two options:

  1. Use await to recreate a convenient synchronous API on top of the library's async API.
  2. Use channels (that work on threads and fibers alike) to communicate between a thread and a fiber.

from pulsar.

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.