Property MaximumExecutionTime
MaximumExecutionTime
Gets or sets the maximum amount of time allowed for the script execution. If the execution time exceeds this limit, the script will be forcefully terminated by cancelling the CancellationToken passed to the script.
Declaration
TimeSpan MaximumExecutionTime { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Remarks
The script needs to periodically check the cancellation token to respond to cancellation requests. Scripts that do not check IsCancellationRequested may continue to run beyond the specified maximum execution time.
while (!cancellationToken.IsCancellationRequested)
{
// Perform work here
}
while (true)
{
// Infinite loop, does not check cancellationToken
}
It's crucial for scripts to implement proper cancellation checks to ensure they can be terminated gracefully.