I'm wondering what the best way to stop listening is?
I am using tail-stream in aws lambda to minimize memory usage: I stream an s3 file into a file buffer and stream the file buffer out to multiple receivers through tail-stream (via sftp client).
Once I have finished streaming in, I want to shutdown gracefully on the next EOF, or immediately if all the bytes have been sent. Currently, I pipe input and output through transforms that count bytes; if I've already sent that number of bytes (on "finish" event of streaming to file), I terminate immediately. Otherwise I wait for the next EOF and emit "end" on the stream. In tests, at least, I am having problems that I don't get another EOF sometimes. I am wondering if emitting "end" will cleanup sufficiently, or if the state of the watcher is somehow borked for my next test? (And/or how better to shutdown except emit "end"? Should I set "endOnError" then emit error?)
I'm wondering what the best way to stop listening is?
I am using tail-stream in aws lambda to minimize memory usage: I stream an s3 file into a file buffer and stream the file buffer out to multiple receivers through tail-stream (via sftp client).
Once I have finished streaming in, I want to shutdown gracefully on the next EOF, or immediately if all the bytes have been sent. Currently, I pipe input and output through transforms that count bytes; if I've already sent that number of bytes (on "finish" event of streaming to file), I terminate immediately. Otherwise I wait for the next EOF and emit "end" on the stream. In tests, at least, I am having problems that I don't get another EOF sometimes. I am wondering if emitting "end" will cleanup sufficiently, or if the state of the watcher is somehow borked for my next test? (And/or how better to shutdown except emit "end"? Should I set "endOnError" then emit error?)