The dashboard was sporadically hanging for several seconds during task creation and settings loading due to multiple compounding issues: - checkForChanges() polled every 1s with SELECT * FROM tasks + full JSON.stringify comparison, blocking the Node.js event loop. Now uses incremental polling (only changed tasks via updatedAt filter). - allocateId() called readConfig() which always ran listWorkflowSteps(), adding unnecessary DB queries while holding the serialization lock. Now uses readConfigFast() that skips workflow steps. - Task creation triggered listWorkflowSteps() up to 3 times per request. Added in-memory cache with invalidation on create/update/delete. - Route handlers used getSettings() (slow path) where getSettingsFast() suffices (POST /tasks, GET /config). - SSE effect in useTasks had searchQuery and refreshTasks in its dependency array, causing EventSource teardown/rebuild on every search change. Moved to refs since the EventSource URL doesn't use searchQuery. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13 KiB
13 KiB