延迟节点
概述
延迟节点用于在执行图中引入延迟。它接受任意数量的输入,并在指定的延迟后,将输入值原封不动地传递给输出。当您需要控制图执行的时间安排时,此节点非常有用。
- 输入
- 输出
- 编辑器设置
输入项
标题 | 数据类型 | 描述 | 默认值 | 备注 |
---|---|---|---|---|
Delay | number | The delay time in milliseconds. | 0 | This input is only available if the "Use Delay Input" setting is enabled. |
Input [i] | any | The ith input that will be passed to output. | N/A | Dynamic number of inputs based on how many connections there are. |
输出
标题 | 数据类型 | 描述 | 备注 |
---|---|---|---|
Output[i] | any | The ith output from the execution of the delay node. | The output will be the same as the corresponding input after the specified delay. |
编辑器设置
设置 | 描述 | 默认值 | 使用输入切换 | 输入数据类型 |
---|---|---|---|---|
Function Name | The delay time in milliseconds. If the "Use Delay Input" setting is not enabled, this value will be used as the delay. | 0 | Yes | number |
使用错误输出 | 如果启用,则Delay节点将使用"Delay"输入作为延迟时间(毫秒)。如果禁用,将使用"Delay"设置中指定的延迟时间。 | False | No | N/A |
示例1:延迟消息
- 创建一个文本节点并将其值设置为"Hello, World!"。
- 创建一个Delay节点并将其"Delay"设置设为5000(5秒)。
- 将Text节点的输出连接到Delay节点的第一个输入。
- 运行图表。请注意,Delay节点的输出将在5秒后才会显示。
错误处理
Delay节点在正常情况下不会出错。如果延迟时间为负数,将被视为零。
常见问题
问:如果我将延迟时间设置为零会发生什么?
A: Delay节点会立即将输入传递到输出,实际上充当一个直通节点。
问:我可以使用Delay节点来限制API调用频率吗?
A: 是的,您可以使用Delay节点来限制API调用的频率。例如,如果您有一个每次运行时都会进行API调用的图表,您可以使用Delay节点来确保API调用每5秒不超过一次。