Widgets/Logic

Suspend Events Widget

Suspend Events Widget

A "Logic" type widget. Suspend Events Widget controls the flow of data by preventing events from passing through for a specified duration after an event is processed. This makes it perfect for implementing rate limiting, creating time-based patterns, or controlling the frequency of events in your workflow.

 

Inputs

  • in (DataType: Anything) The main input port that receives events. After an event passes through, subsequent events will be blocked for the configured delay duration.

  • reset (DataType: Anything) Resets the internal timer, allowing the next event to pass through immediately regardless of the remaining delay time.


Outputs

  • out (DataType: Same as input) Outputs the event data when allowed to pass through. The output maintains the same data type as the input.

  • skipped (DataType: Same as input) Outputs the event data when it is being filtered out due to the suspension period. This allows you to monitor and handle events that are being blocked, maintaining the same data type as the input with dynamic type inference.


Custom Settings

  • Delay Duration — Configure how long to suspend events after one passes through. The delay is specified in milliseconds. Setting it to 0 will allow only the first event to pass through until reset.

Delay Setting

 

📌 Important Notes

  • The delay timer starts when an event successfully passes through
  • Setting delay to 0 will only allow the first event to pass through until reset
  • The reset input can be triggered at any time to allow the next event through

 

Examples

Basic Rate Limiting

This example shows how to use the Suspend Events Widget to limit the rate of events


Drag the example onto the workspace to explore and experiment!



In this example

  1. The Clock widget generates events every 100ms
  2. The Suspend Events widget is configured with a 1000ms delay
  3. The first Counter widget tracks events that pass through the Suspend Events widget, incrementing once per second
  4. The second Counter widget tracks all Clock widget events directly, showing the difference between filtered and unfiltered events
  5. Result: Despite the Clock widget generating events every 100ms, the suspended Counter widget only increments every 1000ms, demonstrating effective rate limiting

 

Manual Reset Example

This example demonstrates the use of the reset functionality by manually triggering a reset event


Drag the example onto the workspace to explore and experiment!



In this example

  1. The Clock widget generates events every 100ms
  2. The Suspend Events widget is configured with a 2000ms delay
  3. The Counter widget counts updates every 2000ms despite faster incoming Clock widget events
  4. The Button widget resets the suspend timer
  5. Result: Events are blocked for 2 seconds after passing through, unless reset is triggered causing the Counter widget to increase immediately

 

Handling Skipped Events

This example shows how to use the new "skipped" output port to handle events that are being filtered out


Drag the example onto the workspace to explore and experiment!



In this example

  1. The Clock widget generates events every 100ms
  2. The Suspend Events widget is configured with a 1000ms delay
  3. The first Counter widget (top) tracks events that pass through the Suspend Events widget, incrementing once per second
  4. The second Counter widget (bottom) tracks events that are skipped via the "skipped" output port
  5. Result: The top Counter widget shows rate-limited events (every 1000ms), while the bottom Counter widget shows all the events that were filtered out during the suspension period, demonstrating how to monitor and handle skipped events

 

📌 Additional Notes

  • The Suspend Events Widget preserves the data type of the input when passing it to the output
  • The Suspend Events Widget maintains its timer state until explicitly reset or the recipe is reloaded

 

Glossary

  • Dynamic Type Inference

    The automatic detection and preservation of data types as they flow through widgets. The Suspend Events Widget uses this to ensure that events sent to the "skipped" port maintain the same data type as the original input, even when the input type changes during execution.