Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(sftp): fix deadlock so last file is deleted This commit reduces the scope of critical sections guarded by scannerMut to remove a deadlock that causes the last file to not be deleted when the SFTP input is used with watching enabled. * refactor(sftp): use for loop in watcher provider `(*watcherPathProvider).Next()` currently uses recursion to loop until a path is found. This commit refactors that function to use a for loop instead which is more straight forward to read. * test(sftp): add test for delete-on-finish bug This integration test makes sure that when `delete_on_finish` is true and watching is enabled that we delete every file. * refactor(sftp): advance to next file in ReadBatch Before this commit, when a file was exuasted the `ReadBatch` method returned ErrNotConnected which cause the engine to call `Connect` again. Aside from being awkward, this causes the connection status to incorrectly be reported as disconnected during normal operation. This commit moves the logic to advance to the next file when the current file is exhuasted into a the ReadBatch method. * fix(sftp): reduce critical sections of mutexes ReadBatch was holding the state lock the while it polled for new files, which blocked AckFns from cleaning up successfully processed files when deleteOnFinish is set to true. * refactor(sftp): create clientPool to manage connection status * fix(sftp): return scanner from (*sftpReader).initScanner This prevents a race condition between two calls to ReadBatch clobbering each other.
- Loading branch information