-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean routine #530
Clean routine #530
Conversation
Adding time_point to connection
@vhvb1989 can you merge this PR ASAP? we're going to release on Aug 27 (Shanghai local time). |
Co-authored-by: Ahson Khan <[email protected]>
void CurlConnectionPool::CleanUp() | ||
{ | ||
std::thread backgroundCleanerThread([]() { | ||
for (;;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an infinite loop. How does it stop when the program exits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might crash the whole program
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it gets stop as soon as there are no connections. If the clean routine removes all connections, the function returns.
if (CurlConnectionPool::s_connectionCounter == 0)
{
// stop the cleaner since there are no connections
CurlConnectionPool::s_isCleanConnectionsRunning = false;
return;
}
this way, is the cleaner removes all connections, it would wait and if in the next check there are no connections it returns and thread finishes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but still, you didn't join
the thread
fixes: #504
This PR: