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
OpenDAS
dynamo
Commits
3c49a02c
"...git@developer.sourcefind.cn:OpenDAS/dynamo.git" did not exist on "c3b847901099bf5c3dd174a3c8ec994b73426833"
Commit
3c49a02c
authored
Apr 03, 2025
by
tlipoca9
Committed by
GitHub
Apr 03, 2025
Browse files
chore: rename duration to timeout (#503)
parent
6795e645
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
lib/runtime/src/component.rs
lib/runtime/src/component.rs
+2
-2
lib/runtime/src/service.rs
lib/runtime/src/service.rs
+6
-6
No files found.
lib/runtime/src/component.rs
View file @
3c49a02c
...
@@ -168,11 +168,11 @@ impl Component {
...
@@ -168,11 +168,11 @@ impl Component {
unimplemented!
(
"endpoints"
)
unimplemented!
(
"endpoints"
)
}
}
pub
async
fn
scrape_stats
(
&
self
,
duration
:
Duration
)
->
Result
<
ServiceSet
>
{
pub
async
fn
scrape_stats
(
&
self
,
timeout
:
Duration
)
->
Result
<
ServiceSet
>
{
let
service_name
=
self
.service_name
();
let
service_name
=
self
.service_name
();
let
service_client
=
self
.drt
()
.service_client
();
let
service_client
=
self
.drt
()
.service_client
();
service_client
service_client
.collect_services
(
&
service_name
,
duration
)
.collect_services
(
&
service_name
,
timeout
)
.await
.await
}
}
...
...
lib/runtime/src/service.rs
View file @
3c49a02c
...
@@ -115,16 +115,16 @@ impl ServiceClient {
...
@@ -115,16 +115,16 @@ impl ServiceClient {
pub
async
fn
collect_services
(
pub
async
fn
collect_services
(
&
self
,
&
self
,
service_name
:
&
str
,
service_name
:
&
str
,
duration
:
Duration
,
timeout
:
Duration
,
)
->
Result
<
ServiceSet
>
{
)
->
Result
<
ServiceSet
>
{
let
sub
=
self
.nats_client
.scrape_service
(
service_name
)
.await
?
;
let
sub
=
self
.nats_client
.scrape_service
(
service_name
)
.await
?
;
if
duration
.is_zero
()
{
if
timeout
.is_zero
()
{
tracing
::
warn!
(
"collect_services:
duration
is zero"
);
tracing
::
warn!
(
"collect_services:
timeout
is zero"
);
}
}
if
duration
>
Duration
::
from_secs
(
10
)
{
if
timeout
>
Duration
::
from_secs
(
10
)
{
tracing
::
warn!
(
"collect_services:
duration
is greater than 10 seconds"
);
tracing
::
warn!
(
"collect_services:
timeout
is greater than 10 seconds"
);
}
}
let
deadline
=
tokio
::
time
::
Instant
::
now
()
+
duration
;
let
deadline
=
tokio
::
time
::
Instant
::
now
()
+
timeout
;
let
services
:
Vec
<
ServiceInfo
>
=
stream
::
until_deadline
(
sub
,
deadline
)
let
services
:
Vec
<
ServiceInfo
>
=
stream
::
until_deadline
(
sub
,
deadline
)
.map
(|
message
|
serde_json
::
from_slice
::
<
ServiceInfo
>
(
&
message
.payload
))
.map
(|
message
|
serde_json
::
from_slice
::
<
ServiceInfo
>
(
&
message
.payload
))
...
...
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