-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
server : implement cancellable request #11285
Conversation
} | ||
|
||
if (result == nullptr) { | ||
i--; // retry |
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.
For i == 0
this will underflow
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 will be i++
as soon as we call continue
anyway, so should not be a big problem. But anw I changed i
to int
, to be more explicit about the case where it can be negative.
(Also, i
is not used anywhere inside the loop body, so I assume that it's safe to make it an int
here)
* server : implement cancellable request * fix typo * httplib 0.18.5 * fix i underflow
Close #9273
Related to yhirose/cpp-httplib#2022
For requests that can take long time like completions or embeddings, the queue will unblock HTTP thread every 1 second to check for the status of HTTP connection.
Because this is done at HTTP thread, it will not affect the performance of inference thread, while still maintaining thread-safety requirement.