Timed Buffer icon

Timed Buffer

Node that queues incoming string data and outputs it all at once after a defined time has passed

Overview

This node, named "Timed Buffer," collects incoming string data items and queues them under a unique session key. It waits for a specified amount of time after the last input before outputting all collected data at once. This buffering mechanism is useful when you want to batch multiple inputs together that arrive within a certain timeframe, reducing the number of downstream executions or API calls.

Common scenarios:

  • Aggregating log messages or events that occur in bursts before processing them collectively.
  • Collecting user inputs or sensor readings over a period and then sending a single consolidated update.
  • Throttling rapid-fire data inputs by grouping them into timed batches.

Example:
You receive multiple chat messages identified by a session key. Instead of processing each message immediately, the node buffers them for 30 seconds after the last message arrives, then outputs all messages as one array for further processing or storage.

Properties

Name Meaning
Session Key Unique identifier string for grouping messages into the same buffer session.
Content The string data to add to the buffer.
Wait Amount Numeric value specifying how long to wait after the last input before outputting the buffer.
Wait Unit Time unit for the Wait Amount; can be Seconds, Minutes, Hours, or Days.
Options Collection of additional options:
• Avoid Key Collisions: Boolean to prevent key collisions across workflows (default true).

Output

The node has two outputs:

  1. Main output ("Resume"): Emits an object with a json property containing:

    • data: An array of all buffered string contents collected during the session.
  2. Secondary output ("Skipped"): Emits empty JSON objects {} when new content is added to an existing buffer but the buffer has not yet expired.

If an error occurs and "Continue On Fail" is enabled, the main output will emit an object with an error field describing the issue.

No binary data is produced by this node.

Dependencies

  • Requires a Redis server connection configured via credentials (an API key or authentication token for Redis).
  • The node uses Redis to store and manage the buffer state keyed by the session key.
  • Proper Redis credentials must be set up in n8n for the node to connect successfully.

Troubleshooting

  • Common issues:

    • Redis connection failures due to incorrect credentials or network issues.
    • Key collisions if multiple workflows use the same session key without enabling the "Avoid Key Collisions" option.
    • Buffer retrieval errors if the stored Redis value is missing or corrupted.
  • Error messages:

    • "Error retrieving buffer state from Redis. Key: "<sessionKey>". Possible causes: nonexistent key, invalid JSON value, or connection error."
      • Indicates failure to read or parse the buffer from Redis. Check Redis connectivity and ensure the key exists.
    • Connection errors or timeouts when connecting to Redis.
      • Verify Redis server availability and credential correctness.
  • Resolutions:

    • Enable "Avoid Key Collisions" to prepend workflow ID to session keys, preventing clashes.
    • Confirm Redis credentials and network access.
    • Ensure Redis server is running and accessible.

Links and References

Discussion