Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ an execution, and does not extend server result retention. It raises the same
missing/cancelled execution errors described above. A second cursor cannot
attach an execution already tracked by that connection.

On SQL sessions that support attachment, attaching a running execution
transfers event delivery to the new connection, even if the previous
connection remains open. The duplicate guard
only covers cursors on one connection. Another connection can attach again and
take event delivery back. The previous connection can also still cancel the
execution, including through cursor close or reuse. Callers must coordinate the
handoff so stale workers cannot reattach or cancel it; attach provides no
cross-connection lock or ownership fencing.

### Stopping the SQL session

Closing a connection leaves its SQL session running until
Expand Down
2 changes: 2 additions & 0 deletions wherobots/db/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def attach(self, execution_id: str, store: Store | None = None) -> None:
Connect to the original SQL session first. Pass the original Store for
stored results. This never submits SQL or extends server result retention;
a missing execution raises ExecutionNotFoundError when fetching.
On SQL sessions that support attachment, this transfers event ownership.
It does not fence other connections; callers must coordinate the handoff.
"""
if not isinstance(execution_id, str) or not execution_id.strip():
raise ProgrammingError("execution_id must be a non-empty string")
Expand Down
Loading