MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / flushNow

Method flushNow

packages/bot-slack/src/message-stream.ts:75–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73 }
74
75 private async flushNow(): Promise<void> {
76 if (this.buffer === this.posted) return;
77 const text = this.buffer;
78 this.posted = text;
79 try {
80 await this.update(text);
81 } catch (err) {
82 // Rate-limit (429) edits are already retried by the Slack WebClient
83 // (honoring Retry-After). If we still land here the edit genuinely
84 // failed — swallow it: a single failed edit shouldn't sink the
85 // stream, and future appends retry with the latest buffer.
86 console.error("[message-stream] update failed:", err);
87 } finally {
88 // Set lastFlushedAt *after* the update returns so the throttle
89 // measures wall-clock time between completions, not starts.
90 this.lastFlushedAt = Date.now();
91 }
92 }
93}

Callers 1

enqueueFlushMethod · 0.95

Calls 3

updateMethod · 0.65
errorMethod · 0.65
nowMethod · 0.65

Tested by

no test coverage detected