Skip to content

Conversation

@foxdan
Copy link
Contributor

@foxdan foxdan commented Jul 25, 2014

If there is no new data being pumped into the tailed files a consumer will
block forever. This allows for a graceful shutdown after draining the files
if the producer has been shut down.

…rator.

If there is no new data being pumped into the tailed files a consumer will
block forever. This allows for a graceful shutdown after draining the files
if the producer has been shut down.
@derpston
Copy link
Owner

I'm not very keen on this because changing some magic variable in order to stop a generator feels odd.

Would it be better to simply stop reading from the generator? (using break to get out of the loop) Or perhaps repeatedly call .poll() until you decide you don't want any more content?

Not keen but open to discussing it further.

@foxdan
Copy link
Contributor Author

foxdan commented Jul 28, 2014

It won't be possible to always break out of the loop if reading from the generator. This happens when there are no new lines to be yielded by the MultiTail object.

The other option is to re-implement the generator using poll and implementing some method to stop it in the consuming code, but it makes the generator in MultiTail redundant.

@derpston
Copy link
Owner

Good point on the first one.

The two interfaces (poll and generator) are provided because some uses aren't compatible with one or or the other, and it seems like the simplest thing to do would be to reimplement the generator in your application. Still not keen on fiddling around "behind" the generator in order to stop it, it feels too weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants