Merged PR 416: Fix database client uninstall failing due to persistent connection
## Summary Change the way db client uninstall happens. Now if a client_connection disconnect fails, we just drop it anyway, not sure if this causes other issues so pls review this diligently, especially @<Charlie Crane> . in case there's a potential issue with not fully dropping connections. ## Test process pytest is running very nicely ## Checklist - [x] PR is linked to a **work item** - [x] **acceptance criteria** of linked ticket are met - [x] performed **self-review** of the code - [x] written **tests** for any new functionality added with this PR - [ ] updated the **documentation** if this PR changes or adds functionality - [ ] written/updated **design docs** if this PR implements new functionality - [ ] updated the **change log** - [x] ran **pre-commit** checks for code style - [x] attended to any **TO-DOs** left in the code Fix database client uninstall failing due to persistent connection
This commit is contained in:
@@ -270,9 +270,16 @@ class DatabaseClient(Application):
|
||||
|
||||
Calls disconnect on all client connections to ensure that both client and server connections are killed.
|
||||
"""
|
||||
while self.client_connections.values():
|
||||
client_connection = self.client_connections[next(iter(self.client_connections.keys()))]
|
||||
client_connection.disconnect()
|
||||
while self.client_connections:
|
||||
conn_key = next(iter(self.client_connections.keys()))
|
||||
conn_obj: DatabaseClientConnection = self.client_connections[conn_key]
|
||||
conn_obj.disconnect()
|
||||
if conn_obj.is_active or conn_key in self.client_connections:
|
||||
self.sys_log.error(
|
||||
"Attempted to uninstall database client but could not drop active connections. "
|
||||
"Forcing uninstall anyway."
|
||||
)
|
||||
self.client_connections.pop(conn_key, None)
|
||||
super().uninstall()
|
||||
|
||||
def get_new_connection(self) -> Optional[DatabaseClientConnection]:
|
||||
|
||||
Reference in New Issue
Block a user