Fork me on GitHub
#core-async
<
2016-06-18
>
genRaiy16:06:05

guys - not sure of this is the right place to ask but I have a small problem writing the equivalent of Unix tail in core.async

genRaiy16:06:13

if I have process writing to the file when I run tail, it all works as expected

genRaiy16:06:53

if the writing process starts after I run tail, it does not output anything

genRaiy16:06:49

I have a feeling I’m missing something obvious so wondered if another pair of eyes (or many pairs of eyes!) could help

genRaiy16:06:54

please ignore this question I just realised that my failing test truncated the file, so in fact the code is OK and my test was faulty

genRaiy16:06:13

sorry to have bothered everyone 😉

genRaiy16:06:44

(btw I know that this is actually the equivalent of tail -1f rather than a proper equivalent of tail; sue me)

ghadi17:06:39

on that note, you shouldn't do blocking I/O in go blocks at all, only channel operations. In thread blocks there is no use-case restriction

ghadi17:06:54

of course this is not enforced programmatically, but if you do enough I/O in go block your will encounter deadlocks @raymcdermott

genRaiy19:06:22

@ghadi: I take your general point but this loop is just reading a file so I don’t think it’s possible to generate a deadlock - further advice welcome

ghadi19:06:03

you'll certainly need more I/O to cause the deadlock

genRaiy19:06:15

ok, just making sure I wasn't missing a more subtle infra aspect