diff --git a/fsspec/implementations/smb.py b/fsspec/implementations/smb.py index 37949939e..867a58158 100644 --- a/fsspec/implementations/smb.py +++ b/fsspec/implementations/smb.py @@ -67,6 +67,7 @@ def __init__( timeout=60, encrypt=None, share_access=None, + register_session_retries=5, **kwargs, ): """ @@ -111,6 +112,7 @@ def __init__( self.encrypt = encrypt self.temppath = kwargs.pop("temppath", "") self.share_access = share_access + self.register_session_retries = register_session_retries self._connect() @property @@ -120,7 +122,7 @@ def _port(self): def _connect(self): import time - for _ in range(5): + for _ in range(self.register_session_retries): try: smbclient.register_session( self.host, diff --git a/fsspec/implementations/tests/test_smb.py b/fsspec/implementations/tests/test_smb.py index da65127b0..9b2afcd0d 100644 --- a/fsspec/implementations/tests/test_smb.py +++ b/fsspec/implementations/tests/test_smb.py @@ -63,6 +63,7 @@ def smb_params(request): "port": request.param, "username": "testuser", "password": "testpass", + "register_session_retries": 100, # max ~= 10 seconds } finally: import smbclient # pylint: disable=import-outside-toplevel