Fork me on GitHub
#funcool
<
2017-01-31
>
flipmokid16:01:32

Hi, I've just started playing around with Catacumba and Clojure and I wanted to ask a quick question. Most of my routes so far map directly to a database call which I'm wrapping in the Catacumba blocking function. Now I'm moving to routes which invoke multiple blocking calls and so I started by doing everything in a go block (with the blocking calls putting values onto channels when complete) for better expression. However doing this gives the error around the blocking function not being called from a compute thread due to it using the go thread pool . I was wondering what would be the best of way of structuring my code, can I get the blocking calls to work in a go block, or should I replace the blocking call with the thread based put and take async functions ( <!! / >!! ) or should I do something else? Any advice is appreciated!

niwinz16:01:32

Hmm, I think using just go and <! is a way to go

niwinz16:01:55

in any case this is nothing related directly to catacumba,

niwinz16:01:16

if you have async server the blocking calls you should defer them to different pool of execution

niwinz16:01:32

go thread pool is an option in this case

niwinz16:01:54

the only responsability you have with catacumba is return something that catacumba can understand from the handler

niwinz16:01:13

and the core.async channel is already valid abstraction

flipmokid16:01:42

Yep sorry, I know it's not directly related to catacumba I just wanted some input on preferred approaches. Many thanks for your suggestion, I'll give it a go!