aleph

wcalderipe 2019-11-19T03:46:31.035600Z

Following up with the async and sync discussion. I still couldn't figure this out so maybe a good soul in the community would post something about it. I'm sure this isn't the first time this issue is bring to the light. I created a repository with the problem scenario: I'm back working in the issue and I created a repository with the scenario.. https://github.com/wcalderipe/lab-compojure-aleph-sync-and-async/blob/master/src/lab_compojure_aleph_async/core.clj

ikitommi 2019-11-19T05:34:10.041Z

@wcalderipe you app should either be fully (sync) ring or async-ring (3 arity). In your example, line41, you define it as sync (1 arity). I don't think you can mix them in ring. Interceptor-model allows you to do it.

wcalderipe 2019-11-19T06:15:02.044800Z

Thanks for taking a look on it 🙌 basically this is my original questions "can sync and async handlers coexist in ring?" and you might have answered it. Also, after you mentioned the interceptor model, I quickly found a good article about it, thanks! https://lispcast.com/a-model-of-interceptors/

pithyless 2019-11-19T08:22:40.045700Z

More interceptor docs: http://pedestal.io/reference/interceptors Although it was really this Cognicast podcast that first introduced me to the reasoning behind Pedestal's interceptors and how they can be useful in modeling flow (outside of HTTP): http://blog.cognitect.com/cognicast-transcripts/118

pithyless 2019-11-19T08:24:14.046Z

I never really used Pedestal for anything, but I sure am happy that Paul deGrandis introduced me to the interceptor pattern. And it's nice that with things like metosin/sieppari I can use them without importing pedestal.

wcalderipe 2019-11-20T22:54:10.052100Z

Thanks for sharing @pithyless I'll definitely listen to it today

ikitommi 2019-11-19T06:33:37.045100Z

an easy comparison: • with middleware: https://github.com/metosin/reitit/blob/master/examples/ring-swagger/src/example/server.clj • with interceptors: https://github.com/metosin/reitit/blob/master/examples/http-swagger/src/example/server.clj … the latter has one route returning a async value, a Manifold Deferred. All others all sync.

wcalderipe 2019-11-19T06:34:22.045500Z

Thanks for sharing it!