fn pause(message: PauseMessage, sender: &Sender<Message>, state: &SharedState) -> Message {
    // Check whether a given group exists
    if let Some(group) = &message.group {
        let state = state.lock().unwrap();
        if !state.groups.contains_key(group) {
            return create_failure_message(format!("Group {} doesn't exists", group));
        }
    }

    sender
        .send(Message::Pause(message.clone()))
        .expect(SENDER_ERR);
    if !message.task_ids.is_empty() {
        let response = task_response_helper(
            "Tasks are being paused",
            message.task_ids,
            vec![TaskStatus::Running],
            state,
        );
        return create_success_message(response);
    }
    if let Some(group) = &message.group {
        create_success_message(format!("Group {} is being paused.", group))
    } else if message.all {
        create_success_message("All queues are being paused.")
    } else {
        create_success_message("Default queue is being paused.")
    }
}
/// Invoked when calling `pueue pause`.
/// Forward the pause message to the task handler, which then pauses groups/tasks/everything.
Invoked when calling `pueue pause`.
Forward the pause message to the task handler, which then pauses groups/tasks/everything.
Invoked when calling ` pueue pause ` . Forward the pause message to the task handler which then pauses groups / tasks / everything .
fn pause(message: PauseMessage, sender: &Sender<Message>, state: &SharedState) -> Message {
    // Check whether a given group exists
    if let Some(group) = &message.group {
        let state = state.lock().unwrap();
        if !state.groups.contains_key(group) {
            return create_failure_message(format!("Group {} doesn't exists", group));
        }
    }
    sender
        .send(Message::Pause(message.clone()))
        .expect(SENDER_ERR);
    if !message.task_ids.is_empty() {
        let response = task_response_helper(
            "Tasks are being paused",
            message.task_ids,
            vec![TaskStatus::Running],
            state,
        );
        return create_success_message(response);
    }
    if let Some(group) = &message.group {
        create_success_message(format!("Group {} is being paused.", group))
    } else if message.all {
        create_success_message("All queues are being paused.")
    } else {
        create_success_message("Default queue is being paused.")
    }
}
fn pause ( message : PauseMessage , sender : & Sender < Message > , state : & SharedState ) -> Message { // Check whether a given group exists if let Some ( group ) = & message . group { let state = state . lock ( ) . unwrap ( ) ; if ! state . groups . contains_key ( group ) { return create_failure_message ( format ! ( " " group ) ) ; } } sender . send ( Message :: Pause ( message . clone ( ) ) ) . expect ( SENDER_ERR ) ; if ! message . task_ids . is_empty ( ) { let response = task_response_helper ( " " , message . task_ids , vec ! [ TaskStatus Running ] , state , ) ; return create_success_message ( response ) ; } if let Some ( group ) = & message . group { create_success_message ( format ! ( " " group ) ) } else if message . all { create_success_message ( " " ) } else { create_success_message ( " " ) } }
Invoked when calling `pueue pause`.
Invoked when calling ` pueue pause ` .
message
PauseMessage
sender
&Sender<Message>
state
&SharedState