- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Still receiving lines after calling unwatch #102
Comments
Hi @BTOdell I would encourage you to review your code and check for mismanaged references. |
I'll try to reproduce the problem in a separate repository and link it here. |
I've created this repository that I have used to successfully reproduce the error: The producer is in Java and the consumer is in Node.js (TypeScript). This closely matches the environments that I was using when the issue was first observed. I enabled logging in your library which helped me find the bug. The "follow" feature is enabled by default and the way you have it implemented is causing the library to start watching again (after 1 second) even if |
Yes, You were having a rename event then? |
I actually don't know why a rename event was triggering because I'm not renaming files, only adding and removing them continuously. Although I've read that the built-in |
fix available in v2.0.4. |
I'm using chokidar to watch for
add
andunlink
events for certain file paths and initializing a new Tail instance when a file is added and unwatching it when the file is unlinked.However, despite unwatching the Tail in the
unlink
handler, the Tail line callback is still being invoked once the file is re-added to the file system. I end up having multiple instances of Tail still watching the file.Note: This is a very simple version of the code that I'm actually running.
If a file is added, written to, removed, then re-added and written to again, the second time the lines will be duplicated along with error messages saying "inactive tail is still producing lines!" from my explicit check in the line callback.
The text was updated successfully, but these errors were encountered: