Skip to main content

ask_and_wait

Function ask_and_wait 

Source
pub async fn ask_and_wait(
    q: &mut Question,
    store: &Questions,
    notify: &Notify,
    timeout: Duration,
) -> Result<Option<String>>
Expand description

File a question and wait for the owner, polling the store.

Returns Ok(None) when the wait times out, so the caller can park the run rather than treat a slow human as an error. The question is left on disk as QuestionStatus::Abandoned; the caller that parks the run and the operator who finds it in the morning both need to see what was asked.

q is updated in place from disk when the answer lands, so the caller can record the answered question without re-reading it.