1 min read
Chat SDK now lets you control what happens when a new message arrives before a previous one finishes processing, with the new concurrency option for the Chat class.
const bot = new Chat({ concurrency: { strategy: "queue", maxQueueSize: 20, onQueueFull: "drop-oldest", queueEntryTtlMs: 60_000, },// ...});Multiple options are supported to customize the feature's functionality.
Four strategies are available:
drop(default): discards new messagesqueue: processes the latest message after the handler finishesdebounce: waits for a pause in conversation, processes only the final messageconcurrent: processes every message immediately, no locking
Read the documentation to get started.