On Sun, Aug 07, 2016 at 10:21:44PM -0600, Timothy Baldridge wrote:
> So I'm tempted to ask at this point, what does your program do? If you're
> doing nothing but CPU work, then yeah you may need to do something in the
> main thread. However, all IO work should be done outside of go block. Go
> blocks are limited in the number of concurrent threads that they use, so
> it's possible to deadlock the pool if you do IO inside the code called by a
> go block. So I'd suggest moving what ever IO work you're doing into
> dedicated threads and that might just solve your problem.
That I shouldn't do I/O in a go block is something I found out
yesterday. This is the first time I seriously use core.async, so I hope
I will be forgiven.
The program isn't doing heavy work, though, so I think my abuse of go
blocks didn't do much harm. It just has a process that regularly (every
five minutes) downloads volcanic ash advisories and puts the data on a
published channel. The subscribers (currently two) send notifications
etc.
If you're unexpectedly interested, you can look at the code here:
https://github.com/rmoehn/sakurajima-ash-service It's pretty terrible,
because I'm was in a hurry and trying several new things at once. Also,
I haven't incorporated the "I/O no go" everywhere, yet.
Thanks for your help! I didn't have much of a problem, only a question
about best practices, but it's good to read your insights!
Richard