Skip to content

Commit

Permalink
close socket on connection failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ajshedivy committed Aug 30, 2024
1 parent 4c4adb8 commit c791a84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions mapepire_python/client/sql_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def connect(self, db2_server: Union[DaemonServer, Dict[str, Any]]) -> Dict[Any,
self._status = JobStatus.Ready
else:
self._status = JobStatus.NotStarted
self.close()
raise Exception(result.get("error", "Failed to connect to server"))

self.id = result["job"]
Expand Down
2 changes: 1 addition & 1 deletion mapepire_python/pool/pool_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async def connect(self, db2_server: Union[DaemonServer, Dict[str, Any]]) -> Dict
self.status = JobStatus.Ready
else:
self.status = JobStatus.NotStarted
print(result)
await self.close()
raise Exception(result.get("error", "Failed to connect to server"))

self.id = result["job"]
Expand Down

0 comments on commit c791a84

Please sign in to comment.