Skip to content

delay in keep_alive due to sleep #1969

@berthubert

Description

@berthubert

Hi,

I have a new user for https://github.com/berthubert/bagconv and they are trying to send loads of queries to my cpp-httplib powered server, and getting timeouts.

I'm still investigating exactly what is going on, but I wonder what this is doing in keep_alive:

std::this_thread::sleep_for(microseconds{interval_usec});

There is already a call to select/poll that will sleep for interval_usec. What does this add, except latency for clients?
I'm also a bit confused why this has to loop so quickly, is this to catch a change in svr_sock to INVALID_SOCKET?

I've removed the sleep_for locally and things appear to be snappier now, and I don't see any problems. But perhaps I am missing something!

Bert

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions