Alf Kristian Støyle
2017-04-10 16:47:25 UTC
Hi.
We're using Aleph with compojure, which is how I found the problem. However
I guess it is a general problem, when trying to keep the server async.
I added following to prevent compojure blocking on deferred, from
(https://github.com/ztellman/aleph/blob/master/examples/src/aleph/examples/http.clj#L54):
(extend-protocol Renderable
manifold.deferred.Deferred
(render [d _] d))
However doing this, now we generally get manifolds threaded through all the
other middlewares. They expect maps, so I we generally get
"manifold.deferred.Deferred cannot be cast to clojure.lang.Associative" in
every middleware.
The "app" set up in simplified version looks like:
(def app
(->
my-routes
session-store-handler
wrap-multipart-params
(cors/wrap-cors
:access-control-allow-credentials true
:access-control-allow-origin "foo.com"
:access-control-allow-methods [:get :put :post :delete :patch])
(wrap-defaults defaults-config)))
Does anyone have any tips on how fix this? I cannot simply change the -> to
a d/chain, I guess since this is a static setup of the server middleware. I
worry I have to re-implement every response handling middleware to be
manifold "aware".
Best regards,
Alf
We're using Aleph with compojure, which is how I found the problem. However
I guess it is a general problem, when trying to keep the server async.
I added following to prevent compojure blocking on deferred, from
(https://github.com/ztellman/aleph/blob/master/examples/src/aleph/examples/http.clj#L54):
(extend-protocol Renderable
manifold.deferred.Deferred
(render [d _] d))
However doing this, now we generally get manifolds threaded through all the
other middlewares. They expect maps, so I we generally get
"manifold.deferred.Deferred cannot be cast to clojure.lang.Associative" in
every middleware.
The "app" set up in simplified version looks like:
(def app
(->
my-routes
session-store-handler
wrap-multipart-params
(cors/wrap-cors
:access-control-allow-credentials true
:access-control-allow-origin "foo.com"
:access-control-allow-methods [:get :put :post :delete :patch])
(wrap-defaults defaults-config)))
Does anyone have any tips on how fix this? I cannot simply change the -> to
a d/chain, I guess since this is a static setup of the server middleware. I
worry I have to re-implement every response handling middleware to be
manifold "aware".
Best regards,
Alf
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.