Skip to content

Commit

Permalink
fix: disconnect rmq in destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
MehmedGIT committed Dec 6, 2024
1 parent b9d0772 commit b6b96de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/server/operandi_server/routers/admin_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def __init__(self):
summary="Push a workspace to Ola-HD service"
)

def __del__(self):
if self.rmq_publisher:
self.rmq_publisher.disconnect()

async def auth_admin_with_handling(self, auth: HTTPBasicCredentials):
py_user_action = await user_auth_with_handling(self.logger, auth)
if py_user_action.account_type != AccountType.ADMIN:
Expand Down
4 changes: 4 additions & 0 deletions src/server/operandi_server/routers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def __init__(self):
response_model=List, response_model_exclude_unset=True, response_model_exclude_none=True
)

def __del__(self):
if self.rmq_publisher:
self.rmq_publisher.disconnect()

async def user_login(self, auth: HTTPBasicCredentials = Depends(HTTPBasic())) -> PYUserAction:
"""
Used for user authentication.
Expand Down

0 comments on commit b6b96de

Please sign in to comment.