From 92e109e2e810deb3a0732a2d2091069b3e8a43bb Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Fri, 24 Oct 2025 12:59:19 +0200 Subject: [PATCH] Fixes timed prompts generation race condition Reorders initialization of in-progress flag to prevent potential race conditions during timed prompt generation Ensures that the in-progress status is set before stopping existing sequences and generates prompts --- commands/timedPrompts.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/timedPrompts.ts b/commands/timedPrompts.ts index 9cb012a..c05c46a 100644 --- a/commands/timedPrompts.ts +++ b/commands/timedPrompts.ts @@ -21,11 +21,13 @@ export class TimedPromptsCommand { new Notice('Timed prompts are already being generated. Please wait.'); return; } + + this.inProgress = true; // Stop any existing timed sequence this.stop(); - this.inProgress = true; + try { // Generate prompts const prompts = await this.promptGenerator.generateTimedPrompts(settings);