Refactor message_handler kill if-else logic
@@ -25,16 +25,19 @@ pub fn kill(message: KillMessage, sender: &Sender<Message>, state: &SharedState)
return create_success_message(response);
}
+ // Special response for signal handling.
if let Some(signal) = message.signal {
- if message.all {
+ return if message.all {
create_success_message(format!("Sending signal {} to all running tasks.", signal))
} else {
create_success_message(format!(
"Sending signal {} to all running tasks of group {}.",
signal, message.group
))
+ };
}
- } else {
+
+ // Response for normal kill logic.
if message.all {
create_success_message("All tasks are being killed.")
} else {
@@ -44,4 +47,3 @@ pub fn kill(message: KillMessage, sender: &Sender<Message>, state: &SharedState)
))
}
}
-}
