Skip to content

Property TimeoutMs

Namespace: Belay.Attributes
Assembly: Belay.Attributes.dll

TimeoutMs

Gets or sets the timeout for teardown method execution in milliseconds. Teardown operations have limited time to complete before forcible disconnection.

csharp
public int TimeoutMs { get; set; }

Property Value

int

Examples

[Teardown(TimeoutMs = 5000)] // 5 seconds for data save
private async Task SaveLargeDatasetAsync()
{
    await ExecuteAsync(@"
        # Save large dataset with progress indication
        if 'large_dataset' in globals():
            print('Saving large dataset...')
            save_dataset_to_flash(large_dataset)
            print('Dataset saved successfully')
    ");
}

[Teardown] // Use default timeout for quick operations
private async Task QuickCleanupAsync()
{
    await ExecuteAsync("quick_cleanup()");
}

Remarks

Teardown operations should complete quickly to avoid delaying disconnection. The default timeout is typically much shorter than normal operation timeouts to ensure responsive disconnection behavior.

Use custom timeouts sparingly and only for operations that genuinely need more time, such as saving large amounts of data or performing complex hardware shutdown sequences.

Exceptions

ArgumentOutOfRangeException

Thrown when setting a timeout value that is less than or equal to zero.

Released under the Apache License 2.0.