sdk
latest
false
- 概述
- 自定义活动
- 将活动迁移到 .NET 6
- 发行说明
- 构建工作流分析器规则
- 构建活动项目设置
- 创建自定义向导
- 按范围划分活动的优先级
- UiPath.Activities.Api.Base
- UiPath.Studio.Activities.Api
- UiPath.Studio.Activities.Api.Activities
- UiPath.Studio.Activities.Api.BusyService
- UiPath.Studio.Activities.Api.ExpressionEditor
- UiPath.Studio.Activities.Api.Expressions
- UiPath.Studio.Activities.Api.Licensing
- UiPath.Studio.Activities.Api.Mocking
- UiPath.Studio.Activities.Api.ObjectLibrary
- UiPath.Studio.Activities.Api.PackageBindings
- UiPath.Studio.Activities.Api.ProjectProperties
- UiPath.Studio.Activities.Api.ScopedActivities
- UiPath.Studio.Activities.Api.Settings
- UiPath.Studio.Activities.Api.Wizards
- UiPath.Studio.Activities.Api.Workflow
- UiPath.Studio.Api.Controls
- UiPath.Studio.Api.Telemetry
- UiPath.Studio.Api.Theme
- Robot JavaScript SDK
- 触发器 SDK
重要 :
请注意此内容已使用机器翻译进行了部分本地化。
开发者指南
Last updated 2024年10月25日
超时
“超时” 开关可向活动添加“超时” 属性。 如果活动未在此属性指定的时间内完成执行,则会引发错误。 默认超时自动设置为 60000 毫秒(1 分钟)。
Activity Creator
生成的代码
具有超时的活动包含一个
ExecuteWithTimeout
方法,其中包含该活动的执行逻辑。 此方法在主 ExecuteAsync
方法中调用,并在设定的时间量(默认为 60 秒)后超时。
protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
{
// Inputs
var timeout = TimeoutMS.Get(context);
// Set a timeout on the execution
var task = ExecuteWithTimeout(context, cancellationToken);
if (await Task.WhenAny(task, Task.Delay(timeout, cancellationToken)) != task) throw new TimeoutException(Resources.Timeout_Error);
// Outputs
return (ctx) => { };
}
private async Task ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default)
{
///////////////////////////
// Add execution logic HERE
///////////////////////////
}
protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
{
// Inputs
var timeout = TimeoutMS.Get(context);
// Set a timeout on the execution
var task = ExecuteWithTimeout(context, cancellationToken);
if (await Task.WhenAny(task, Task.Delay(timeout, cancellationToken)) != task) throw new TimeoutException(Resources.Timeout_Error);
// Outputs
return (ctx) => { };
}
private async Task ExecuteWithTimeout(AsyncCodeActivityContext context, CancellationToken cancellationToken = default)
{
///////////////////////////
// Add execution logic HERE
///////////////////////////
}
UiPath Studio 中的效果