File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -747,7 +747,8 @@ async function main() {
747747 if ( process . env . CODEBASE_CONTEXT_DEBUG ) console . error ( '[DEBUG] Server ready' ) ;
748748
749749 // Auto-refresh: watch for file changes and trigger incremental reindex
750- const debounceMs = parseInt ( process . env . CODEBASE_CONTEXT_DEBOUNCE_MS ?? '' , 10 ) || 2000 ;
750+ const debounceEnv = Number . parseInt ( process . env . CODEBASE_CONTEXT_DEBOUNCE_MS ?? '' , 10 ) ;
751+ const debounceMs = Number . isFinite ( debounceEnv ) && debounceEnv >= 0 ? debounceEnv : 2000 ;
751752 const stopWatcher = startFileWatcher ( {
752753 rootPath : ROOT_PATH ,
753754 debounceMs,
Original file line number Diff line number Diff line change @@ -77,8 +77,9 @@ describe('FileWatcher', () => {
7777 // Give chokidar a moment to finish initializing before the first write
7878 await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) ) ;
7979 await fs . writeFile ( path . join ( tempDir , 'cancel.ts' ) , 'export const y = 99;' ) ;
80- // Let chokidar detect the event but stop before debounce fires
81- await new Promise ( ( resolve ) => setTimeout ( resolve , 150 ) ) ;
80+ // Let chokidar detect the event (including awaitWriteFinish stabilityThreshold)
81+ // but stop before the debounce window expires.
82+ await new Promise ( ( resolve ) => setTimeout ( resolve , 350 ) ) ;
8283 stop ( ) ;
8384 // Wait past where debounce would have fired
8485 await new Promise ( ( resolve ) => setTimeout ( resolve , debounceMs + 200 ) ) ;
You can’t perform that action at this time.
0 commit comments