()
| 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 | } |
no test coverage detected