Skip to content

Commit 73003bc

Browse files
Import leader-change error codes from dqlitewire
The 10250/10506 magic-number tuple used by DqliteConnection to decide whether a protocol error means "invalidate and reconnect" is now owned by dqlitewire.constants. Drop the local definition and re-import. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7d7ce38 commit 73003bc

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/dqliteclient/connection.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818
DqliteProtocol,
1919
_validate_positive_int_or_none,
2020
)
21+
from dqlitewire import LEADER_ERROR_CODES as _LEADER_ERROR_CODES
2122
from dqlitewire.exceptions import EncodeError as _WireEncodeError
2223

23-
# dqlite error codes that indicate a leader change (SQLite extended error codes)
24-
# SQLITE_IOERR_NOT_LEADER = SQLITE_IOERR | (40 << 8) = 10250
25-
# SQLITE_IOERR_LEADERSHIP_LOST = SQLITE_IOERR | (41 << 8) = 10506
26-
_LEADER_ERROR_CODES = {10250, 10506}
27-
2824

2925
def _parse_address(address: str) -> tuple[str, int]:
3026
"""Parse a host:port address string, handling IPv6 brackets."""

0 commit comments

Comments
 (0)