Ability to close SFTP connection on demand
hasfoug opened this issue · comments
Feature Request
Add ability to close SFTP connection manually
Q | A |
---|---|
Flysystem Version | 3.24.0 |
Adapter Name | league/flysystem-sftp-v3 |
Adapter version | 3.23.1 |
Scenario / Use-case
I have a set of ~20 daily jobs that connect to SFTP server and upload files there (a single file per job). Now, since this is all managed by Laravel horizon, the connection is not being closed after file upload is done and since server has limit for connections it ends up not allowing last jobs in the queue to upload their files. This happens because jobs that already uploaded their files and finished successfully have not closed their connection (disconnect function is being called in __destruct method of SSH2 class which is never being called in this case). So, i just need to close connection manually after a file is successfully uploaded.
Summary
Pls provide a way to disconnect from SFTP server on demand by either:
- adding a disconnect function on SftpAdapter class
- OR adding getConnectionProvider() method to SftpAdapter class and getConnection() method to SftpConnectionProvider class so that disconnect method can be called from there.