Skip to content

Commit 555ff76

Browse files
committed
fix: fastedge-run handler for terminate signal
1 parent 7ded439 commit 555ff76

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use smol_str::{SmolStr, ToSmolStr};
2929
use std::collections::HashMap;
3030
use std::path::PathBuf;
3131
use std::time::Duration;
32+
use tokio::signal;
3233
use wasmtime::component::Component;
3334
use wasmtime::{Engine, Module};
3435

@@ -167,11 +168,16 @@ async fn main() -> anyhow::Result<()> {
167168
listen_fd: None,
168169
backoff: 64,
169170
});
171+
let mut terminate = signal::unix::signal(signal::unix::SignalKind::terminate())?;
170172
tokio::select! {
171173
res = http => {
172174
res?
173175
},
174-
_ = tokio::signal::ctrl_c() => {
176+
_ = signal::ctrl_c() => {
177+
#[cfg(target_family = "unix")]
178+
shutdown_coordinator.shutdown().await
179+
}
180+
_ = terminate.recv() => {
175181
#[cfg(target_family = "unix")]
176182
shutdown_coordinator.shutdown().await
177183
}

0 commit comments

Comments
 (0)