This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-03
Channels
- # arachne (31)
- # aws (9)
- # bangalore-clj (7)
- # beginners (46)
- # boot (18)
- # cider (21)
- # cljs-dev (8)
- # clojure (154)
- # clojure-dusseldorf (5)
- # clojure-filipino (3)
- # clojure-ireland (4)
- # clojure-italy (9)
- # clojure-russia (6)
- # clojure-spec (6)
- # clojure-uk (52)
- # clojureremote (3)
- # clojurescript (173)
- # clojurewest (14)
- # cursive (24)
- # data-science (2)
- # datomic (18)
- # defnpodcast (1)
- # devcards (1)
- # hoplon (4)
- # instaparse (29)
- # jobs (2)
- # juxt (1)
- # leiningen (3)
- # lumo (78)
- # off-topic (46)
- # om (9)
- # onyx (42)
- # pedestal (33)
- # perun (3)
- # re-frame (9)
- # reagent (6)
- # slack-help (5)
- # spacemacs (2)
- # specter (6)
- # unrepl (157)
- # untangled (99)
- # yada (32)
Is there a quick way to diagnose schema failures? Dump them to a log or something? I’m running an external test against a yada server, it’s failing because something they send me doesn’t match my schema, but I’m not sure what.
I know there are errors sent back to the caller in the http response body, but I don’t have an easy way to see that.
It probably does somewhere, but that’s all in magic code inside my {:methods {:post {:parameters {:body my-schema} … } }
resource - I guess I’m not sure where to hook in error checking myself. Anyway I’m going to leave it until after work, will give it a better look then
Actually I’m also tempted to follow Postel’s law, and just get rid of the schema check entirely. It’s nice as a proof of concept to say “hey, we can check schemas” but TBH I’m not keen on writing code which type checks incoming data too rigorously.
@korny schema checks get more useful the bigger your api gets - we have shared client/server schema and it's brilliant for flushing out bugs after api changes (not as good as static checks, but pretty good for clojureland), particularly in development. it's a bit more ambiguous in production, since it can make older clients unnecessarily incompatible with newer servers
I have an async question. Consider the following async endpoint:
;; [aleph.http :as http]
;; [manifold.deferred :as d]
["/async"
(yada/resource
{:produces "application/json"
:methods
{:get
{:response (fn [ctx]
(d/chain (http/get "")
(fn [resp]
{:result (slurp (:body resp))})))}}})]
Behind localhost:3000/example is an endpoint that has a (Thread/sleep 5000)
. It runs in a different process. I’m firing 20 requests to the Yada endpoint.
What I expect now is when I retrieve a static resource, it won’t take much longer than normal (5ms). But it takes several seconds even.
Is my expectation wrong?hmm - that shouldn't affect static resources served by yada though, since it's the threadpool of a separate process
Hmm. This is odd
Your expectation is correct
But it's a separate proc
@dominicm The Thead/sleep is in a different process. From the perspective of Yada this is just IO
@malcolmsparks Do you want me to wrap this into an example project, so you can run it?
What versions of yada/manifold/aleph? I'd like to replicate tonight
Yes please
(Terrible internet here)
@malcolmsparks Reproduced the issue here: https://github.com/borkdude/yada-async-test/tree/master
@borkdude there's a max concurrent number of requests to the same domain in browsers, your README says you run the test from the same browser (tho different tabs). I think you hit a browser limitation and not a yada bug
Try the 20 request to /api/async with apache bench or something instead of from a browser
@malcolmsparks So, mystery solved
Nice detective work!