refactor: extract is_aborted helpers, DRY 16 call sites

This commit is contained in:
asepharyana
2026-07-18 03:18:27 +07:00
parent ff47bffe0c
commit 086cb86f0d
6 changed files with 43 additions and 38 deletions
@@ -198,7 +198,7 @@ impl LlmClient {
// Check abort before each retry so user cancellation is
// responsive even during a long non-streaming backoff chain.
if abort_flag.is_some_and(|f| f.load(std::sync::atomic::Ordering::SeqCst)) {
if crate::app::util::abort::is_aborted_ref(abort_flag) {
anyhow::bail!("aborted");
}
@@ -373,7 +373,7 @@ impl LlmClient {
if meaningful_content {
// Check abort before entering the blocking non-streaming
// call — otherwise the fallback ignores user cancellation.
if abort_flag.is_some_and(|f| f.load(std::sync::atomic::Ordering::SeqCst)) {
if crate::app::util::abort::is_aborted_ref(abort_flag) {
return Err(anyhow::anyhow!("aborted"));
}
tracing::warn!(