MCPcopy Create free account
hub / github.com/acking-you/static_flow / apply_runner_result

Function apply_runner_result

crates/backend/src/article_request_worker.rs:515–588  ·  view source on GitHub ↗
(
    store: &ArticleRequestStore,
    email_notifier: Option<&Arc<EmailNotifier>>,
    request: &ArticleRequestRecord,
    request_id: &str,
    run_id: &str,
    exit_code: Option<i32>,
    result: 

Source from the content-addressed store, hash-verified

513}
514
515async fn apply_runner_result(
516 store: &ArticleRequestStore,
517 email_notifier: Option<&Arc<EmailNotifier>>,
518 request: &ArticleRequestRecord,
519 request_id: &str,
520 run_id: &str,
521 exit_code: Option<i32>,
522 result: ArticleRequestRunnerResult,
523) -> bool {
524 match result.outcome {
525 ArticleRequestRunnerOutcome::Success {
526 ingested_article_id,
527 } => {
528 if let Err(err) = store
529 .transition_request(
530 request_id,
531 REQUEST_STATUS_DONE,
532 None,
533 None,
534 Some(&ingested_article_id),
535 Some(&result.reply_markdown),
536 )
537 .await
538 {
539 let reason = format!("failed to mark request done: {err}");
540 let _ = store
541 .finalize_ai_run(
542 run_id,
543 REQUEST_AI_RUN_STATUS_FAILED,
544 exit_code,
545 Some(&reason),
546 Some(&result.reply_markdown),
547 )
548 .await;
549 mark_request_failed(store, request_id, &reason, Some(&result.reply_markdown)).await;
550 return false;
551 }
552 send_request_done_notification(
553 email_notifier,
554 request,
555 Some(&ingested_article_id),
556 &result.reply_markdown,
557 )
558 .await;
559
560 let _ = store
561 .finalize_ai_run(
562 run_id,
563 REQUEST_AI_RUN_STATUS_SUCCESS,
564 exit_code,
565 None,
566 Some(&result.reply_markdown),
567 )
568 .await;
569 true
570 },
571 ArticleRequestRunnerOutcome::Failed {
572 failure_reason,

Callers 1

process_one_requestFunction · 0.85

Calls 4

mark_request_failedFunction · 0.85
transition_requestMethod · 0.80
finalize_ai_runMethod · 0.45

Tested by

no test coverage detected