Skip to content

fix: Revert closing connection in SFTP get_client #320

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
## 0.3.12-dev3
## 0.3.12-dev4

### Enhancements

* **Migrate Vectara Destination Connector to v2**

### Fixes
* **Revert closing connection in SFTP source** which caused more closed socket errors

## 0.3.12-dev2

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion unstructured_ingest/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.12-dev3" # pragma: no cover
__version__ = "0.3.12-dev4" # pragma: no cover
11 changes: 2 additions & 9 deletions unstructured_ingest/v2/processes/connectors/fsspec/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,8 @@ def get_access_config(self) -> dict[str, Any]:
@contextmanager
@requires_dependencies(["paramiko", "fsspec"], extras="sftp")
def get_client(self, protocol: str) -> Generator["SFTPFileSystem", None, None]:
# The paramiko.SSHClient() client that's opened by the SFTPFileSystem
# never gets closed so explicitly adding that as part of this context manager
from fsspec import get_filesystem_class

client: SFTPFileSystem = get_filesystem_class(protocol)(
**self.get_access_config(),
)
yield client
client.client.close()
with super().get_client(protocol=protocol) as client:
yield client


@dataclass
Expand Down
Loading