fix(discord): prevent stuck typing indicator

This commit is contained in:
Nimrod Gutman
2026-02-25 10:16:00 +02:00
committed by Nimrod Gutman
parent fb76e316fb
commit a0fa283839
3 changed files with 40 additions and 5 deletions

View File

@@ -723,12 +723,18 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
dispatchError = true;
throw err;
} finally {
// Must stop() first to flush debounced content before clear() wipes state
await draftStream?.stop();
if (!finalizedViaPreviewMessage) {
await draftStream?.clear();
try {
// Must stop() first to flush debounced content before clear() wipes state.
await draftStream?.stop();
if (!finalizedViaPreviewMessage) {
await draftStream?.clear();
}
} catch (err) {
// Draft cleanup should never keep typing alive.
logVerbose(`discord: draft cleanup failed: ${String(err)}`);
} finally {
markDispatchIdle();
}
markDispatchIdle();
if (statusReactionsEnabled) {
if (dispatchError) {
await statusReactions.setError();