Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
88bb627d
Unverified
Commit
88bb627d
authored
Oct 09, 2025
by
Simo Lin
Committed by
GitHub
Oct 09, 2025
Browse files
[router] change grpc client from mutable to clone (#11394)
parent
b520958e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
sgl-router/src/core/worker.rs
sgl-router/src/core/worker.rs
+1
-1
sgl-router/src/grpc_client/sglang_scheduler.rs
sgl-router/src/grpc_client/sglang_scheduler.rs
+17
-13
No files found.
sgl-router/src/core/worker.rs
View file @
88bb627d
...
...
@@ -554,7 +554,7 @@ impl Worker for BasicWorker {
return
Ok
(
false
);
};
let
mut
client
=
grpc_client
.lock
()
.await
;
let
client
=
grpc_client
.lock
()
.await
;
match
time
::
timeout
(
timeout
,
client
.health_check
())
.await
{
Ok
(
Ok
(
resp
))
=>
{
tracing
::
debug!
(
...
...
sgl-router/src/grpc_client/sglang_scheduler.rs
View file @
88bb627d
use
std
::
convert
::
TryFrom
;
use
std
::
time
::
Duration
;
use
tonic
::{
transport
::
Channel
,
Request
};
use
tonic
::{
transport
::
Channel
,
Request
,
Streaming
};
use
tracing
::
debug
;
use
crate
::
protocols
::
spec
::{
...
...
@@ -54,18 +54,18 @@ impl SglangSchedulerClient {
/// Submit a generation request (returns streaming response)
pub
async
fn
generate
(
&
mut
self
,
&
self
,
req
:
proto
::
GenerateRequest
,
)
->
Result
<
tonic
::
Streaming
<
proto
::
GenerateResponse
>
,
Box
<
dyn
std
::
error
::
Error
+
Send
+
Sync
>>
{
)
->
Result
<
Streaming
<
proto
::
GenerateResponse
>
,
Box
<
dyn
std
::
error
::
Error
+
Send
+
Sync
>>
{
let
mut
client
=
self
.client
.clone
();
let
request
=
Request
::
new
(
req
);
let
response
=
self
.
client
.generate
(
request
)
.await
?
;
let
response
=
client
.generate
(
request
)
.await
?
;
Ok
(
response
.into_inner
())
}
/// Perform health check
pub
async
fn
health_check
(
&
mut
self
,
&
self
,
)
->
Result
<
proto
::
HealthCheckResponse
,
Box
<
dyn
std
::
error
::
Error
+
Send
+
Sync
>>
{
debug!
(
"Sending health check request"
);
let
request
=
Request
::
new
(
proto
::
HealthCheckRequest
{
...
...
@@ -75,43 +75,47 @@ impl SglangSchedulerClient {
}),
});
let
response
=
self
.client
.health_check
(
request
)
.await
?
;
let
mut
client
=
self
.client
.clone
();
let
response
=
client
.health_check
(
request
)
.await
?
;
debug!
(
"Health check response received"
);
Ok
(
response
.into_inner
())
}
/// Abort a request
pub
async
fn
abort_request
(
&
mut
self
,
&
self
,
request_id
:
String
,
reason
:
String
,
)
->
Result
<
(),
Box
<
dyn
std
::
error
::
Error
+
Send
+
Sync
>>
{
let
request
=
Request
::
new
(
proto
::
AbortRequest
{
request_id
,
reason
});
self
.client
.abort
(
request
)
.await
?
;
let
mut
client
=
self
.client
.clone
();
client
.abort
(
request
)
.await
?
;
Ok
(())
}
/// Get model information
pub
async
fn
get_model_info
(
&
mut
self
,
&
self
,
)
->
Result
<
proto
::
GetModelInfoResponse
,
Box
<
dyn
std
::
error
::
Error
+
Send
+
Sync
>>
{
debug!
(
"Requesting model info"
);
let
request
=
Request
::
new
(
proto
::
GetModelInfoRequest
{});
let
response
=
self
.client
.get_model_info
(
request
)
.await
?
;
let
mut
client
=
self
.client
.clone
();
let
response
=
client
.get_model_info
(
request
)
.await
?
;
debug!
(
"Model info response received"
);
Ok
(
response
.into_inner
())
}
/// Get server information
pub
async
fn
get_server_info
(
&
mut
self
,
&
self
,
)
->
Result
<
proto
::
GetServerInfoResponse
,
Box
<
dyn
std
::
error
::
Error
+
Send
+
Sync
>>
{
debug!
(
"Requesting server info"
);
let
request
=
Request
::
new
(
proto
::
GetServerInfoRequest
{});
let
response
=
self
.client
.get_server_info
(
request
)
.await
?
;
let
mut
client
=
self
.client
.clone
();
let
response
=
client
.get_server_info
(
request
)
.await
?
;
debug!
(
"Server info response received"
);
Ok
(
response
.into_inner
())
}
...
...
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