Skip to content

Commit 3b42040

Browse files
jokemanfiremxpv
authored andcommitted
optimize: use a more user-friendly interface in ttrpc
Signed-off-by: jokemanfire <[email protected]>
1 parent 8130e41 commit 3b42040

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/runc-shim/src/service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
use std::{env::current_dir, sync::Arc};
17+
use std::{env::current_dir, sync::Arc, time::Duration};
1818

1919
use ::runc::options::DeleteOpts;
2020
use async_trait::async_trait;
@@ -27,7 +27,7 @@ use containerd_shim::{
2727
event::Event,
2828
io_error,
2929
monitor::{Subject, Topic},
30-
protos::{events::task::TaskExit, protobuf::MessageDyn, ttrpc::context::with_timeout},
30+
protos::{events::task::TaskExit, protobuf::MessageDyn, ttrpc::context::with_duration},
3131
util::{
3232
convert_to_timestamp, read_options, read_pid_from_file, read_runtime, read_spec, timestamp,
3333
write_str_to_file,
@@ -228,7 +228,7 @@ async fn forward(
228228
// Prevent event reporting from taking too long time.
229229
// Learnd from goshim's containerd/runtime/v2/shim/publisher.go
230230
publisher
231-
.publish(with_timeout(5000000000), &topic, &ns, e)
231+
.publish(with_duration(Duration::from_secs(5)), &topic, &ns, e)
232232
.await
233233
.unwrap_or_else(|e| warn!("publish {} to containerd: {}", topic, e));
234234
}

0 commit comments

Comments
 (0)