-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: respect context and add request cancellation #7187
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
Conversation
Signed-off-by: Ettore Di Giacinto <[email protected]>
✅ Deploy Preview for localai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Seems we can't propagate client disconnection during non-SSE requests due to |
|
just as a note, echo doesn't have such issues: labstack/echo#1581 |
578b94f to
6cc3285
Compare
Signed-off-by: Ettore Di Giacinto <[email protected]>
6cc3285 to
38125d9
Compare
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
53d8f39 to
89e9874
Compare
Signed-off-by: Ettore Di Giacinto <[email protected]>
89e9874 to
64519a6
Compare
| go func() { | ||
| defer func() { | ||
| // Clear read deadline when goroutine exits | ||
| conn.SetReadDeadline(time.Time{}) |
Check warning
Code scanning / gosec
Errors unhandled Warning
| case <-ticker.C: | ||
| // Set a short deadline - if connection is closed, read will fail immediately | ||
| // If connection is open but no data, it will timeout and we check again | ||
| conn.SetReadDeadline(time.Now().Add(50 * time.Millisecond)) |
Check warning
Code scanning / gosec
Errors unhandled Warning
Signed-off-by: Ettore Di Giacinto <[email protected]>
64519a6 to
4839d57
Compare
|
found an ugly workaround, but works for our case. Would be nice if fasthttp supports this natively, but I guess for now that's the only way we can tackle this. |
Description
This PR binds the token generation to the request context, and for llama.cpp it implements job cancellation.
It also adds the stop icon now in place of the loading icon, that will abort the request.
Notes for Reviewers
Fixes: #974
Signed commits