Upgrading from 0.8 to 0.9
Two items under ### Breaking.
executor_timeout defaults to one hour
It was unbounded. An executor that never returned pinned its task, its event
queue and its cancellation token for the life of the process, and with
max_cancellation_tokens at 10,000, enough of them eventually stopped the
handler accepting work. A task that trips the ceiling now fails visibly, as a
Failed task with a timeout error.
If a task of yours legitimately exceeds an hour, either raise the ceiling or
restore unbounded execution explicitly with the new
without_executor_timeout(). The constant is
a2a_protocol_server::builder::DEFAULT_EXECUTOR_TIMEOUT.
#![allow(unused)] fn main() { use std::time::Duration; use a2a_protocol_server::RequestHandlerBuilder; fn six_hours(builder: RequestHandlerBuilder) -> RequestHandlerBuilder { builder.with_executor_timeout(Duration::from_secs(6 * 3600)) } fn as_in_0_8(builder: RequestHandlerBuilder) -> RequestHandlerBuilder { builder.without_executor_timeout() } }
The changelog's own advice: a task genuinely running longer than an hour should be using push notifications rather than holding an executor and a stream open.
shutdown() and shutdown_with_timeout() return ShutdownReport
Both returned () and discarded the executor-cleanup timeout with no log and
no return value, which made a hung cleanup indistinguishable from a clean
drain. The type is #[must_use], so an existing handler.shutdown().await;
still compiles and warns rather than errors. Only a let () = … binding, or
a function whose return type was () and ended with the call, breaks.
// 0.8
handler.shutdown_with_timeout(Duration::from_secs(10)).await;
#![allow(unused)] fn main() { use std::time::Duration; use a2a_protocol_server::{RequestHandler, ShutdownReport}; async fn stop(handler: &RequestHandler) { let report: ShutdownReport = handler .shutdown_with_timeout(Duration::from_secs(10)) .await; if !report.is_graceful() { eprintln!( "shutdown incomplete: {} queue(s) force-destroyed, executor cleanup completed: {}", report.queues_force_destroyed, report.executor_cleanup_completed ); } } }
Until 0.14, queues_force_destroyed was always 0 for shutdown(), whatever
it cut off; it now counts the live queues it destroyed.
executor_cleanup_completed == false means the on_shutdown hook was
abandoned, not that it failed — it may still be running.
Back to Upgrading Between Minor Versions.