Skip to content

Commit

Permalink
Merge pull request #14 from black-cape/await_on_conn_close
Browse files Browse the repository at this point in the history
await on client disconnect
  • Loading branch information
huanchh2 committed Aug 8, 2023
2 parents 58183c9 + 03fc06c commit 398a39b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions etl/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def insert_file(self, filedata: FileObject):
LOGGER.error(f'unexpected error occured inserting a record in file tracking table {exc}')
finally:
if client:
client.disconnect()
await client.disconnect()

async def update_status_by_fileName(self, filename: str, new_status: str):
""" Update the file status/state """
Expand All @@ -53,7 +53,7 @@ async def update_status_by_fileName(self, filename: str, new_status: str):
LOGGER.error(f'unexpected error occured updating a record in file tracking table {exc}')
finally:
if client:
client.disconnect()
await client.disconnect()

async def update_status_and_fileName(self, rowid: str, new_status: str, new_filename: str):
""" Update the file status/state and the file name """
Expand All @@ -72,7 +72,7 @@ async def update_status_and_fileName(self, rowid: str, new_status: str, new_file
LOGGER.error(f'unexpected error occured updating a record in file tracking table {exc}')
finally:
if client:
client.disconnect()
await client.disconnect()

async def delete_file(self, rowid: str) -> None:
if not settings.clickhouse_host or settings.clickhouse_host == 'UNSET':
Expand All @@ -88,7 +88,7 @@ async def delete_file(self, rowid: str) -> None:
LOGGER.error(f'unexpected error occured deleting a record {exc}')
finally:
if client:
client.disconnect()
await client.disconnect()

async def query(self, status: Optional[str] = None) -> List[FileObject]:
if not settings.clickhouse_host or settings.clickhouse_host == 'UNSET':
Expand Down Expand Up @@ -122,7 +122,7 @@ async def query(self, status: Optional[str] = None) -> List[FileObject]:
LOGGER.error(f'unexpected error occured querying file tracking table {exc}')
finally:
if client:
client.disconnect()
await client.disconnect()

def parse_notification(self, evt_data: Any) -> FileObject:
""" Parse a Minio notification to create a DB row """
Expand Down

0 comments on commit 398a39b

Please sign in to comment.