Fork me on GitHub
#ring
<
2021-09-02
>
Douglas Ramos14:09:10

Hey everyone! I've been working with pedestal for some time and now I want to learn a bit about ring and its middleware model. One thing in my research that I always find is that this model, early in the days, made it difficult to ring to work with async. Could someone explain why? I know that middleware is about function composition but I simply don't see why this is a problem in comparison to the interceptor model

seancorfield15:09:33

Ring uses different arities for sync and async so middleware has to also have both arities implemented (and a lot of middleware out there does not).

🙌 2
Ben Sless09:09:09

Something which stumped me regarding non blocking ring mws is calling async functions in the middleware. The handler must be invoked on the async function's callback This has the unpleasant consequence of getting off the thread pool the handler was invoked in. Only solution I've been able to find is giving everyone the same executor service. Is that even a good idea?

seancorfield16:09:19

No idea. I've never even tried to use the async stuff in Ring.