Welcome to Zuora Product Documentation

Explore our rich library of product information

Time: Delay

This reference describes the Time: Delay task.

The "Time: Delay" task performs a specified time delay for a workflow. You can define the delay time in seconds in the task settings.

Concurrency Mode: Controls whether Workflow processes tasks in a single or multi-threaded manner for this task type. Select Sequential to single-thread, or Parallel to allow multi-threaded processing.

If you select Parallel, the Max Concurrency setting controls the maximum number of threads for this task type that can be utilized. You can specify a value from 1 up to the allowed maximum for this task type. A value of 1 behaves the same as Sequential processing.

Example: If there is a set of 10 records that is being iterated over, selecting Sequential will process one record and the downstream tasks for that iteration before processing the next record and its downstream tasks. If Parallel is selected, multiple records or batches can be processed at the same time, up to the configured Max Concurrency limit.

Note: The Concurrency Mode setting does not affect the batch size setting. Workflow first determines the batch size, and then uses Concurrency Mode and Max Concurrency to determine how those batches are processed.

Example

The following steps provide an example of using the Delay task to set up retry logic.
  1. For the task that you want to retry (for example, SFTP task), create a Failure branch, and add an If task.

  2. For the If task, specify the logic to determine whether the predefined number of retries is reached and, if not, calculate the next wait time. The following code block increments the retry count by one and calculates the wait time (waitSeconds). For each new retry, the backOff variable will have a new value.

    {%- if Data.Liquid.retryCount == nil -%}
      {%- assign retryCount = 1 -%}
      {%- assign backOff = GlobalConstants.backOffMultiplier |
            plus: 0.00 -%}
    {%- else -%}
      {%- assign retryCount = Data.Liquid.retryCount |
            plus: 1 -%}
      {%- assign backOff = Data.Liquid.backOff |
            times: GlobalConstants.backOffMultiplier -%}
    {%- endif -%}
    {% if retryCount <= 3 %}
      {%- assign waitSeconds = GlobalConstants.retryMinutes |
            times: 60.0 | times: backOff -%}
    True
    {% else %}
    False
    {% endif %}
  3. Add a Delay task after the If task, and connect the Success branch of the Delay task to the start of the SFTP task to complete the loop. The Delay task performs a time delay that is equal to the wait time (waitSeconds) calculated in the If task (step 2). Set the delay time of the task with the following Liquid expression:

    {{Data.Liquid.waitSeconds}}

    For the name of the task, you can also include this Liquid expression so that the actual number of minutes for each retry will be recorded in the task run.

    Wait for {{Data.Liquid.waitSeconds | divided_by: 60}} mins