Skip to content

Silence urllib3 HTTP connection debug spam when DB-API is down - #14

Draft
lefi7z wants to merge 2 commits into
masterfrom
cursor/silence-urllib3-connect-debug-003f
Draft

Silence urllib3 HTTP connection debug spam when DB-API is down#14
lefi7z wants to merge 2 commits into
masterfrom
cursor/silence-urllib3-connect-debug-003f

Conversation

@lefi7z

@lefi7z lefi7z commented Aug 7, 2026

Copy link
Copy Markdown
Member

Problem

With root logging at DEBUG (e.g. -vvv on the testing CLI), connecting to a DB-API that is not running floods the console with:

[DEBUG] Starting new HTTP connection (6133): 127.0.0.1:5066

That line comes from urllib3, not application code. It was triggered because IoniConnect.connect() polled is_connected (HTTP GET /api/ping) in a tight loop with only 10 ms between attempts, using the same (6.06, 27) timeouts as production traffic.

Changes

  1. pytrms/__init__.py — Set logging.getLogger("urllib3") to WARNING by default. Opt-in HTTP wire logging remains available via enable_extended_logging().
  2. pytrms/clients/db_api.pyconnect() now loops until timeout_s (default 10 s) with inlined GET /api/ping probes using (0.5, 3) timeouts and 250 ms spacing between failures. Steady-state _fetch_object() calls still use (6.06, 27).
  3. tests/test_logging.py — Assert urllib3 stays at WARNING+ unless extended logging is enabled.
  4. tests/test_db_api_connect.py — Cover probe timeouts and successful connect after a transient failure.

Note

If you need full urllib3/request traces for debugging HTTP, call pytrms.enable_extended_logging(logging.DEBUG) as before.

Open in Web Open in Cursor 

cursoragent and others added 2 commits August 7, 2026 10:00
Set urllib3’s default log level to WARNING so DEBUG root logging does not
print a line on every TCP connect. Slow IoniConnect.connect() polling from
10ms to 250ms when the server is down.

Co-authored-by: lefi7z <lefi7z@users.noreply.github.com>
Wait up to timeout_s with short (0.5, 3) GET /api/ping attempts and 250 ms
spacing instead of polling is_connected with production (6.06, 27) timeouts.

Co-authored-by: lefi7z <lefi7z@users.noreply.github.com>
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.

2 participants