Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
6a1391eb
Unverified
Commit
6a1391eb
authored
Oct 14, 2025
by
Yan Ru Pei
Committed by
GitHub
Oct 14, 2025
Browse files
feat: router frees request from slot manager on stopped requests (#3623)
Signed-off-by:
PeaBrane
<
yanrpei@gmail.com
>
parent
400dceae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
lib/llm/src/kv_router.rs
lib/llm/src/kv_router.rs
+25
-8
No files found.
lib/llm/src/kv_router.rs
View file @
6a1391eb
...
...
@@ -569,18 +569,35 @@ impl AsyncEngine<SingleIn<PreprocessedRequest>, ManyOut<Annotated<LLMEngineOutpu
let
mut
response_stream
=
self
.inner
.direct
(
updated_request
,
instance_id
)
.await
?
;
let
stream_context
=
response_stream
.context
();
let
chooser
=
self
.chooser
.clone
();
let
context_for_monitoring
=
stream_context
.clone
();
let
wrapped_stream
=
Box
::
pin
(
async_stream
::
stream!
{
if
let
Some
(
first_item
)
=
response_stream
.next
()
.await
{
let
mut
prefill_marked
=
false
;
loop
{
tokio
::
select!
{
biased
;
_
=
context_for_monitoring
.stopped
()
=>
{
tracing
::
debug!
(
"Request {context_id} cancelled, ending stream"
);
break
;
}
item
=
response_stream
.next
()
=>
{
let
Some
(
item
)
=
item
else
{
break
;
};
if
!
prefill_marked
{
if
let
Err
(
e
)
=
chooser
.mark_prefill_completed
(
&
context_id
)
.await
{
tracing
::
warn!
(
"Failed to mark prefill completed for request {context_id}: {e:?}"
);
}
yield
first_item
;
prefill_marked
=
true
;
}
while
let
Some
(
item
)
=
response_stream
.next
()
.await
{
yield
item
;
}
}
}
if
let
Err
(
e
)
=
chooser
.free
(
&
context_id
)
.await
{
tracing
::
warn!
(
"Failed to free request {context_id}: {e:?}"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment