Skip to content

request() retries fetch twice, which can cause timeouts that are twice as long as requested #191

Open
@dhalbert

Description

@dhalbert

request() tries twice to get a socket, connect, and fetch twice:

# We may fail to send the request if the socket we got is closed already. So, try a second
# time in that case.
retry_count = 0
last_exc = None
while retry_count < 2:
retry_count += 1

This is confusing because if it tries a second time, it can make the default or user specified timeout (see #9210) appear to take twice as long as requested.

I am not sure about the circumstances the comment is talking about:

# We may fail to send the request if the socket we got is closed already. So, try a second

and whether it's true for non-ESP32-SPI, etc. I wonder if some checking or resetting of the socket can be done in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions