Skip to content

value-delay

Description

The value-delay block delays forwarding changes received on its input. Each input value is stored for the configured amount of time and then forwarded to the block's only output.

The block has one input and one output. It supports all logic value types.

Configuration parameters

Parameter name Value
delay_milliseconds Required delay time in milliseconds. Allowed range: from 100 ms to 600000 ms (10 minutes).
max_queued_messages Required maximum size of the queue of pending messages. Allowed range: from 1 to 100.
queue_overflow_mode Required behavior when the queue becomes full. Allowed values: drop, replace_oldest, replace_newest.

Input handling

The block accepts every change sent to its input, regardless of the value type. Each received change is placed in the queue and gets its scheduled emission time calculated from the delay_milliseconds parameter.

If multiple changes are to be emitted at the same moment, the block preserves the order in which they originally arrived.

When the queue is full, the block reacts according to queue_overflow_mode:

  • drop: the new change is ignored
  • replace_oldest: the oldest pending message is removed before the new message is added
  • replace_newest: the new message replaces the most recent pending message

If no other block is connected to the block input, the block reports the Input disconnected. error.

Block outputs

The block has one output. After the configured time has elapsed, the same change that previously arrived at the input is emitted at the output, only delayed.

The description visible below the block informs about the current queue state, and after the first successful emission also about the last value that was sent:

  • queue empty means the queue is empty
  • queued: N means that N messages are currently waiting in the queue
  • queue empty, last: X means the queue is empty and X was the last value emitted by the block
  • queued: N, last: X means that N messages are currently waiting in the queue and X was the last value emitted by the block

The last: X part is not shown before the first successful queue emission.

Errors visible to the user

The block can display the following error messages:

Error code Error description
Invalid delay_milliseconds configuration. The delay_milliseconds parameter is outside the allowed range or is not a valid number.
Invalid max_queued_messages configuration. The max_queued_messages parameter is outside the allowed range of 1 to 100 or is not a valid number.
Invalid queue_overflow_mode configuration. The queue_overflow_mode parameter has a value other than drop, replace_oldest, or replace_newest.
Input disconnected. No other block is connected to the block input.

Other messages starting with Failed to ... or the Invalid queue overflow mode. message indicate an internal problem in the block rather than an invalid value provided by the user. In such a case, it is worth checking the block configuration and connections, and if the problem still occurs, reporting it as a defect.

Examples

  • For delay_milliseconds = 500, the false -> true message received at the input will be emitted at the output after about 500 ms.
  • After the first successful emission of the false -> true message, the block description will contain the last: true fragment.
  • If three messages enter the queue one after another, all three will be emitted after their delay time in the same order in which they reached the block.
  • With max_queued_messages = 2 and queue_overflow_mode = drop, the third message received before the first two are emitted will be ignored.
  • With max_queued_messages = 2 and queue_overflow_mode = replace_oldest, the third message will remove the oldest pending message from the queue and then be added as the new last message in the queue.
  • With max_queued_messages = 2 and queue_overflow_mode = replace_newest, the third message will remove the most recent pending message from the queue and take its place.