Skip to content

Commit 5c681e2

Browse files
committed
wip
1 parent bad6db6 commit 5c681e2

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

Dockerfile.cross

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ ARG BUILDPLATFORM
99
# Copy the pre-built binary based on the target platform
1010
COPY dist/bin/${TARGETPLATFORM}/ev-reth /usr/local/bin/ev-reth
1111

12-
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
13-
1412
# Expose default ports
1513
EXPOSE 8545 8546 30303 6060 9001
1614

bin/ev-reth/src/main.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,15 @@ fn main() {
238238
let shutdown_timeout = Duration::from_secs(30);
239239

240240
// Wait for the node to finish shutting down with a timeout
241-
// The handle will be dropped automatically, triggering shutdown
241+
// Drop the handle to trigger shutdown, then wait for the node exit future
242+
drop(handle);
243+
244+
// Wait for the node to actually exit with a timeout
242245
let shutdown_result = timeout(shutdown_timeout, async {
243-
// Drop the handle to trigger shutdown
244-
drop(handle);
245-
// Give the node time to clean up
246-
tokio::time::sleep(Duration::from_millis(100)).await;
246+
// The node should exit gracefully after dropping the handle
247+
// We can't wait on node_exit_future here since handle is dropped,
248+
// but dropping the handle should trigger proper cleanup
249+
tokio::time::sleep(Duration::from_millis(500)).await;
247250
Ok(())
248251
}).await;
249252

@@ -254,7 +257,7 @@ fn main() {
254257
}
255258
Err(_) => {
256259
tracing::warn!("=== EV-RETH: Node shutdown timed out after {:?} ===", shutdown_timeout);
257-
info!("=== EV-RETH: Node shutdown process completed ===");
260+
info!("=== EV-RETH: Forcing application exit ===");
258261
Ok(())
259262
}
260263
}

bin/ev-reth/src/signal_tests.rs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ mod tests {
1313
assert!(result.is_ok(), "Should be able to create SIGTERM handler");
1414
}
1515

16-
/// Test that SIGINT signal handler can be created (Unix only)
17-
#[tokio::test]
18-
#[cfg(unix)]
19-
async fn test_sigint_handler_creation() {
20-
let result = signal::unix::signal(signal::unix::SignalKind::interrupt());
21-
assert!(result.is_ok(), "Should be able to create SIGINT handler");
22-
}
23-
2416
/// Test that Ctrl+C handler can be created
2517
#[tokio::test]
2618
async fn test_ctrl_c_handler_creation() {
@@ -89,34 +81,25 @@ mod tests {
8981
assert!(result.is_ok(), "Shutdown signal branch should be selected");
9082
}
9183

92-
/// Test that multiple signal handlers can be created simultaneously (Unix only)
84+
/// Test that SIGTERM and Ctrl+C handlers can be created simultaneously (Unix only)
9385
#[tokio::test]
9486
#[cfg(unix)]
95-
async fn test_multiple_signal_handlers() {
87+
async fn test_sigterm_and_ctrl_c_handlers() {
9688
let sigterm_result = signal::unix::signal(signal::unix::SignalKind::terminate());
97-
let sigint_result = signal::unix::signal(signal::unix::SignalKind::interrupt());
9889

9990
assert!(
10091
sigterm_result.is_ok(),
10192
"Should be able to create SIGTERM handler"
10293
);
103-
assert!(
104-
sigint_result.is_ok(),
105-
"Should be able to create SIGINT handler"
106-
);
10794

108-
// Test that we can set up the same pattern as in main.rs
95+
// Test that we can set up the same pattern as in main.rs (SIGTERM + ctrl_c)
10996
let shutdown_signal = async {
11097
let mut sigterm = sigterm_result.unwrap();
111-
let mut sigint = sigint_result.unwrap();
11298

11399
tokio::select! {
114100
_ = sigterm.recv() => {
115101
println!("=== TEST: SIGTERM received ===");
116102
}
117-
_ = sigint.recv() => {
118-
println!("=== TEST: SIGINT received ===");
119-
}
120103
_ = signal::ctrl_c() => {
121104
println!("=== TEST: Ctrl+C received ===");
122105
}

0 commit comments

Comments
 (0)