Skip to content

Commit

Permalink
Store.connect: only reset ssh if force_reset True
Browse files Browse the repository at this point in the history
  • Loading branch information
rkingsbury committed Nov 4, 2023
1 parent 80585fb commit 9ed8cb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/maggma/stores/gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ def connect(self, force_reset: bool = False):
force_reset: whether to reset the connection or not when the Store is
already connected.
"""
if self.ssh_tunnel is None:
host = self.host
port = self.port
else:
self.ssh_tunnel.start()
host, port = self.ssh_tunnel.local_address

if not self._coll or force_reset:
if self.ssh_tunnel is None:
host = self.host
port = self.port
else:
self.ssh_tunnel.start()
host, port = self.ssh_tunnel.local_address

Check warning on line 141 in src/maggma/stores/gridfs.py

View check run for this annotation

Codecov / codecov/patch

src/maggma/stores/gridfs.py#L140-L141

Added lines #L140 - L141 were not covered by tests

conn: MongoClient = (
MongoClient(
host=host,
Expand Down
14 changes: 7 additions & 7 deletions src/maggma/stores/mongolike.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ def connect(self, force_reset: bool = False):
force_reset: whether to reset the connection or not when the Store is
already connected.
"""
if self.ssh_tunnel is None:
host = self.host
port = self.port
else:
self.ssh_tunnel.start()
host, port = self.ssh_tunnel.local_address

if self._coll is None or force_reset:
if self.ssh_tunnel is None:
host = self.host
port = self.port
else:
self.ssh_tunnel.start()
host, port = self.ssh_tunnel.local_address

conn: MongoClient = (
MongoClient(
host=host,
Expand Down

0 comments on commit 9ed8cb8

Please sign in to comment.