fix: when send failed, treat the request as stopped (#673)

release-notes-05
Meng Zhang 2023-10-29 23:27:09 -07:00 committed by GitHub
parent de827b1e74
commit 89a63dbf33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -90,7 +90,10 @@ impl AsyncTextInferenceEngine {
// Cancelled by client side or hit eos.
stopped = true;
} else if let Some(new_text) = decoding.next_token(token_id) {
tx.send(new_text).await.expect("send failed");
match tx.send(new_text).await {
Ok(_) => (),
Err(_) => stopped = true,
}
} else {
// Stoop words stopped
stopped = true;