Skip to content

Keep FBNS connected on read timeout#403

Merged
subzeroid merged 1 commit into
mainfrom
fix/fbns-read-timeout-state
Jul 1, 2026
Merged

Keep FBNS connected on read timeout#403
subzeroid merged 1 commit into
mainfrom
fix/fbns-read-timeout-state

Conversation

@subzeroid

Copy link
Copy Markdown
Owner

What

  • Keep FbnsClient.connected true when a read attempt raises TimeoutError.
  • Preserve the existing behavior where closed sockets / transport failures mark FBNS disconnected.
  • Add regression coverage for the timeout path.

Why

A read timeout means no MQTT packet arrived before the socket timeout; it does not prove the socket is closed. The previous cleanup fix treated every _recv_packet() exception as fatal.

Verification

  • RED: PYTHONDONTWRITEBYTECODE=1 .venv/bin/pytest -q tests/regression/test_fbns.py::FbnsClientRegressionTestCase::test_fbns_read_once_keeps_client_connected_on_socket_timeout failed before the fix with fbns.connected false.
  • PYTHONDONTWRITEBYTECODE=1 .venv/bin/ruff check aiograpi/realtime/fbns.py tests/regression/test_fbns.py
  • PYTHONDONTWRITEBYTECODE=1 .venv/bin/pytest -q tests/regression/test_fbns.py
  • PYTHONDONTWRITEBYTECODE=1 .venv/bin/pytest -q tests/regression

Mirrored in instagrapi: subzeroid/instagrapi#2717

Closes #402

@subzeroid subzeroid merged commit 057b25a into main Jul 1, 2026
13 checks passed
@subzeroid subzeroid deleted the fix/fbns-read-timeout-state branch July 1, 2026 23:24
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.

[BUG] FBNS MQTT Timeout on read causes a disconnection

1 participant