Skip to content

Commit

Permalink
remove UDS socket files
Browse files Browse the repository at this point in the history
  • Loading branch information
MehmedGIT committed Oct 2, 2024
1 parent 611b6b5 commit 9a71d04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ocrd/mets_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def kill_process(mets_server_pid: int):
def shutdown(self):
if self.is_uds:
if Path(self.url).exists():
self.log.debug(f'UDS socket {self.url} still exists, removing it')
self.log.warning(f"Due to a server shutdown, removing the existing UDS socket file: {self.url}")
Path(self.url).unlink()
# os._exit because uvicorn catches SystemExit raised by sys.exit
_exit(0)
Expand Down
3 changes: 3 additions & 0 deletions src/ocrd_network/runtime_data/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ def stop_uds_mets_server(self, mets_server_url: str, stop_with_pid: bool = False
raise Exception(message)
mets_server_pid = self.mets_servers[Path(mets_server_url)]
OcrdMetsServer.kill_process(mets_server_pid=mets_server_pid)
if Path(mets_server_url).exists():
self.log.warning(f"Deployer is removing the existing UDS socket file: {mets_server_url}")
Path(mets_server_url).unlink()
return
# TODO: Reconsider this again
# Not having this sleep here causes connection errors
Expand Down

0 comments on commit 9a71d04

Please sign in to comment.