Skip to content

Property TimeoutMs

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

TimeoutMs

Gets or sets the timeout for method execution in milliseconds. If not specified (or set to -1), uses the default timeout configured for the device.

csharp
public int TimeoutMs { get; set; }

Property Value

int

Examples

[Task(TimeoutMs = 30000)] // 30 second timeout
public async Task CalibrateAsync()
{
    // Long-running calibration process
    await ExecuteAsync(@"
        import time
        # Perform multi-step calibration
        for step in range(10):
            perform_calibration_step(step)
            time.sleep(2)  # Wait between steps
        save_calibration_data()
    ");
}

Remarks

Use custom timeouts for methods that may take longer to execute than typical device operations, such as sensor calibration routines or file operations.

Setting too short a timeout may cause premature cancellation of legitimate long-running operations. Setting too long a timeout may delay error detection for failed operations.

Exceptions

ArgumentOutOfRangeException

Thrown when setting a timeout value that is less than or equal to zero (except -1).

Released under the Apache License 2.0.