Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
docs: Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol committed Oct 4, 2021
1 parent 9e0cd14 commit 1259b3a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ai/backend/manager/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ async def begin_readonly(self, deferrable: bool = False) -> AsyncIterator[SAConn
@actxmgr
async def advisory_lock(self, lock_id: AdvisoryLock) -> AsyncIterator[None]:
lock_acquired = False
# Here we use the session-level advisory lock,
# which follows the lifetime of underlying DB connection.
# As such, we should keep using one single connection for both lock and unlock ops.
async with self.connect() as lock_conn:
try:
# It is usually a BAD practice to directly interpolate strings into SQL statements,
Expand Down

0 comments on commit 1259b3a

Please # to comment.