Fork me on GitHub
#yada
<
2017-10-02
>
nha16:10:43

In Aleph we have to be careful not to block the thread in the request handler (I think), instead we can use streams, deferred etc. In Yada we can return a modified context map, does that mean that if we have blocking operations in the handler we are blocking a server thread? Ie. if I have synchronous code, or a Thread/sleep in my handler, database call etc. what would be the way to do this inside a Yada handler? I don’t remember seeing anything special done in the yada examples I have seen so far (ex. phonebook), maybe there was no need in these particular examples (in-memory atom instead of a DB call)? Is there a document that clarifies the “yada memory model”? Maybe an example of composing synchronous/blocking slow functions in a Yada handler?

malcolmsparks16:10:53

Hi @nha. You should avoid blocking APIs in your yada code. Where you must block, you should use a future. Where you call use a callback API, use a promise.

nha17:10:25

Ok that makes sense 🙂 I though about it when reading aleph docs, it probably should be mentioned somewhere for yada as well (unless I missed it), even if this is just a link to aleph.

dominicm17:10:45

@danielcompton I'm not on github right now, but pretty reverses the stack trace, if that's what you mean

kpsf18:10:10

Hi, I'm looking to use Yada with multipart/mixed as the mime-type. Is this supported and if it is, how would I access the parameters?

danielcompton19:10:46

@dominicm yeah, it reverses the stack trace which is good in the console, but bad rendering to HTML cause you start reading from the top

dominicm19:10:19

Okay, just checking you knew it wasn't a bug :)

dominicm19:10:31

It must be fixable, because boot did it

danielcompton19:10:11

Yeah, you can tell it to reverse