Skip to content

Commit

Permalink
do not destroy client if related to the session
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Mar 1, 2024
1 parent c8ca3a1 commit 12b36f3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/omero/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2092,8 +2092,14 @@ def _resetOmeroClient(self):
logger.debug(self.ice_config)

if self.c is not None:
self.c.__del__()
self.c = None
try:
if self.c.getSessionId() != self._sessionUuid:
self.c.__del__()
self.c = None
except omero.ClientError: # no session available
self.c.__del__()
self.c = None
pass

if self.host is not None:
if self.port is not None:
Expand Down Expand Up @@ -2145,17 +2151,14 @@ def connect(self, sUuid=None):
logger.debug(
"was connected, creating new omero.client")
self._resetOmeroClient()
print("Client created")
# timeout to allow this is $ omero config set
# omero.sessions.timeout 3600000
s = self.c.joinSession(self._sessionUuid)
s.detachOnDestroy()
print("Session joined")
self.SERVICE_OPTS = self.createServiceOptsDict()
logger.debug(
'Joined Session OK with Uuid: %s'
% (self._sessionUuid,))
print("Join %s:" % self._sessionUuid)
self._was_join = True
except Ice.SyscallException: # pragma: no cover
raise
Expand Down

0 comments on commit 12b36f3

Please sign in to comment.