TimeoutPolicy

interface TimeoutPolicy

An interface for policies that enforce a timeout on suspendable operations.

This policy wraps a suspendable block of code and ensures it completes within a specified maximum execution Duration. If the operation exceeds the timeout, it will be cancelled.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun <T> execute(block: suspend () -> T): T

Executes block with a time limit. If execution exceeds the configured timeout, it is cancelled.