Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix (rest-plugins): Correct the return type of if-condition to ensure zenohd get the error. #1416

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEFAULT_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
// http_port: 8000,
// /// The number of worker thread in TOKIO runtime (default: 2)
// /// The configuration only takes effect if running as a dynamic plugin, which can not reuse the current runtime.
// work_thread_num: 0,
// work_thread_num: 2,
// /// The number of blocking thread in TOKIO runtime (default: 50)
// /// The configuration only takes effect if running as a dynamic plugin, which can not reuse the current runtime.
// max_block_thread_num: 50,
Expand Down
4 changes: 3 additions & 1 deletion plugins/zenoh-plugin-rest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ impl Plugin for RestPlugin {
timeout(Duration::from_millis(1), TOKIO_RUNTIME.spawn(task)).await
});

if let Ok(Err(e)) = task {
// The spawn task (TOKIO_RUNTIME.spawn(task)) should not return immediately. The server should block inside.
// If it returns immediately (for example, address already in use), we can get the error inside Ok
if let Ok(Ok(Err(e))) = task {
bail!("REST server failed within 1ms: {e}")
}
Ok(Box::new(RunningPlugin(conf)))
Expand Down
Loading