You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(functions): add request cancellation to invoke via abortSignal (#1593)
## Summary
Adds request cancellation to `FunctionsClient.invoke`, closing the gap
versus the canonical compliance matrix. `invoke` now accepts an optional
`abortSignal` Future; completing it cancels the in-flight HTTP request
and throws `RequestAbortedException`, mirroring how the database client
exposes cancellation through `PostgrestBuilder.abortSignal`.
This is done idiomatically with the `http` package's
`AbortableRequest`/`AbortableMultipartRequest` (wiring `abortTrigger`),
so it works for both regular and multipart invocations.
`RequestAbortedException` is re-exported from the package so callers can
catch it.
A per-invocation timeout is now expressible as `invoke(..., abortSignal:
Future.delayed(duration))`, so the previously `not_applicable`
`functions.invocation.timeout` note is updated accordingly.
## Outcome
**implemented**
## Reference
Mirrors the existing Dart
`database.using_modifiers.request_cancellation` idiom
(`PostgrestBuilder.abortSignal`).
## Compliance matrix
- `functions.invocation.request_cancellation` → **implemented** (symbol
`FunctionsClient.invoke` registered)
## Tests
- Aborting an in-flight request throws `RequestAbortedException`
- Aborting a multipart request throws `RequestAbortedException`
- A never-firing signal lets the request complete normally
SDK-1310
note: "A per-invocation timeout would only wrap the returned Future and cannot abort the in-flight request, so a caller could still see the function succeed after a timeout fires. That is identical to the caller applying Future.timeout themselves, so exposing it as an option adds no capability and would be misleading."
note: "A genuine timeout that aborts the in-flight request is already expressible as `invoke(..., abortSignal: Future.delayed(duration))` via functions.invocation.request_cancellation, so a dedicated timeout option would add no capability over that."
0 commit comments