% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/infra__heartbeat.R
\name{.with_heartbeat}
\alias{.with_heartbeat}
\title{Run a Function with Task-Scoped Heartbeat}
\usage{
.with_heartbeat(
  fn,
  label = "run_task",
  interval_sec = 20L,
  stall_after_sec = 180L,
  start_phase = "backend_invoke",
  start_detail = "run_task",
  complete_phase = "backend_complete",
  complete_detail = "run_task_returned",
  error_phase = "backend_error",
  verbose = FALSE
)
}
\arguments{
\item{fn}{Function to execute.}

\item{label}{Label shown in heartbeat output.}

\item{interval_sec}{Mid-speed cadence in seconds.}

\item{stall_after_sec}{Idle threshold for "stalled" status.}

\item{start_phase}{Phase marker set before \code{fn()}.}

\item{start_detail}{Detail marker set before \code{fn()}.}

\item{complete_phase}{Phase marker set after successful \code{fn()}.}

\item{complete_detail}{Detail marker set after successful \code{fn()}.}

\item{error_phase}{Phase marker set when \code{fn()} errors.}

\item{verbose}{Emit local start/stop diagnostics.}
}
\value{
Result of \code{fn()}.
}
\description{
Run a Function with Task-Scoped Heartbeat
}
\keyword{internal}
