Skip to content

fix(coordination): split AdvisoryLock into sync and async variants#9

Merged
35C4n0r merged 1 commit into
mainfrom
35C4n0r/fix-advisory-lock-cursor-mismatch
May 24, 2026
Merged

fix(coordination): split AdvisoryLock into sync and async variants#9
35C4n0r merged 1 commit into
mainfrom
35C4n0r/fix-advisory-lock-cursor-mismatch

Conversation

@35C4n0r

@35C4n0r 35C4n0r commented May 24, 2026

Copy link
Copy Markdown
Owner
  • the single AdvisoryLock class used sync with for try_acquire/release and async with for atry_acquire/arelease, but PostgresSaver._cursor() is a sync context manager and AsyncPostgresSaver._cursor() is async - mixing them caused TypeError at runtime
  • split into SyncAdvisoryLock (PostgresSaver) and AsyncAdvisoryLock (AsyncPostgresSaver); each class only uses the cursor protocol that matches its checkpointer
  • SyncAdvisoryLock.atry_acquire/arelease delegate to the sync methods so it remains usable from asweep() when paired with PostgresSaver
  • AsyncAdvisoryLock.try_acquire/release raise NotImplementedError since AsyncPostgresSaver has no sync cursor path
  • update get_advisory_lock() return type and sweeper.py annotation

- the single AdvisoryLock class used sync with for try_acquire/release and
  async with for atry_acquire/arelease, but PostgresSaver._cursor() is a
  sync context manager and AsyncPostgresSaver._cursor() is async - mixing
  them caused TypeError at runtime
- split into SyncAdvisoryLock (PostgresSaver) and AsyncAdvisoryLock
  (AsyncPostgresSaver); each class only uses the cursor protocol that
  matches its checkpointer
- SyncAdvisoryLock.atry_acquire/arelease delegate to the sync methods so
  it remains usable from asweep() when paired with PostgresSaver
- AsyncAdvisoryLock.try_acquire/release raise NotImplementedError since
  AsyncPostgresSaver has no sync cursor path
- update get_advisory_lock() return type and sweeper.py annotation
@35C4n0r 35C4n0r merged commit e0e87ff into main May 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant