Closed mattdeboard closed 8 years ago
Well spotted! It's not an incorrect expectation - it was incorrect of me to state/implement that as the behaviour.
As long as the queue is empty, the fetch loop within receive!
won't write anything to the channel - and rejected writes are the only means it currently has of figuring out whether the consumer is done.
So, something like "on the first rejected write, processing will cease" would be more accurate. It's easy to imagine this being a real-life problem. I've addressed it in a branch (via dubious means - using a separate control channel to signal termination is probably the right thing to do).
Clojars is down, it looks like - otherwise I'd have pushed an updated 0.4.4-SNAPSHOT. I'll let you know when I do. I've tested the fix, though would appreciate if you could verify it against your example above.
Deployed 0.4.4-SNAPSHOT
Any input on this?
I was curious about the connections being made to AWS when using your library. So, I entered this at the command line to watch what connections Java was making:
watch -n 2 lsof -nPi | grep java
I then invoked this function:
While everything does appear to work as expected -- the bytes in the
BufferedWriter
get written to disk, and, after 500ms, the channel is closed and the buffer is flushed to disk -- the HTTPS connections to AWS seem to either stay open or are refreshed continuously. According to the docs, "once the channel is closed, processing will cease."Am I doing something wrong in the code? Is my expectation that the connections would be closed incorrect?