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
0802ecd9
"...ssh:/git@developer.sourcefind.cn:2222/OpenDAS/dynamo.git" did not exist on "aeb79e62775d7436fb14fe45acc75c64c9e2526e"
Unverified
Commit
0802ecd9
authored
Aug 05, 2025
by
Yan Ru Pei
Committed by
GitHub
Aug 06, 2025
Browse files
feat: recorder graceful drop (#2327)
parent
8291172f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
lib/llm/src/recorder.rs
lib/llm/src/recorder.rs
+9
-15
No files found.
lib/llm/src/recorder.rs
View file @
0802ecd9
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use
serde
::{
Deserialize
,
Serialize
};
use
std
::
io
;
...
...
@@ -386,6 +374,12 @@ where
}
}
impl
<
T
>
Drop
for
Recorder
<
T
>
{
fn
drop
(
&
mut
self
)
{
self
.cancel
.cancel
();
}
}
/// Helper function to create a rotated file path with an index suffix
fn
create_rotated_path
(
base_path
:
&
Path
,
index
:
usize
)
->
PathBuf
{
let
path_str
=
base_path
.to_string_lossy
();
...
...
@@ -471,11 +465,11 @@ mod tests {
// Check that both events were recorded
assert_eq!
(
recorder
.event_count
()
.await
,
2
);
// Check that the elapsed time is between
9
and 1
1
milliseconds
// Check that the elapsed time is between
7
and 1
3
milliseconds
let
elapsed_ms
=
recorder
.elapsed_time
()
.await
.unwrap
()
.as_millis
();
if
!
(
9
..=
1
1
)
.contains
(
&
elapsed_ms
)
{
if
!
(
7
..=
1
3
)
.contains
(
&
elapsed_ms
)
{
println!
(
"Actual elapsed time: {} ms"
,
elapsed_ms
);
assert
!
((
9
..=
1
1
)
.contains
(
&
elapsed_ms
));
assert
!
((
7
..=
1
3
)
.contains
(
&
elapsed_ms
));
}
// Force shutdown to flush file
...
...
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