sleep-for
The sleep-for function waits for the specified number of seconds before returning the second argument. The value of the second argument can be of any type (a string, number, stream, etc.) or an expression. If no specific return value is needed, a simple placeholder such as 0 can be used.
This function is useful in On-Retry blocks (example below) or for testing purposes.
Signature
sleep-for(number as number, a as any type) -> a |
Parameters
Name | Type | Description |
|---|---|---|
number | number | The number of seconds for which the step should be delayed. |
a | any type | Returns the result. |
Example
The example below shows a Protected block that calls the /system/ftp/retrieve function to download a file from the FTP server to the local directory. If the execution of the retrieve function fails, this step will be retried five times. On each retry, the sleep-for function will be computed. FlowForce Server will wait for 30 seconds, return the 'Retrying after 30 seconds' string, and then try to download the file again.
