Skip to content

Commit 6f2bcf3

Browse files
committed
fix: replace 23 raw setTimeout calls in Logo engine with ManagedTimer to prevent zombie timers
The Logo execution engine (js/logo.js) used 23 raw setTimeout/setInterval calls for animation dispatch, note scheduling, and completion polling. When users hit Stop, these timers were never cancelled — creating 'zombie timers' that continue firing into the next run, causing ghost animations, doubled audio, and UI glitches. Changes: - Add js/utils/ManagedTimer.js (277 lines): centralized timer lifecycle manager with setTimeout, setGuardedTimeout, setInterval, setGuardedInterval, clearAll, and diagnostic getStats/resetStats methods - Replace all 23 raw setTimeout calls in logo.js with managed/guarded variants that auto-cancel when the stop flag is set - Wire ManagedTimer into RequireJS loader (js/loader.js) as a dependency of Logo - Call timerManager.clearAll() at the top of doStopTurtles() so every pending timer is cancelled the instant the user presses Stop - Harden Publisher.dataToTags with try/catch + Array.isArray guard for malformed project JSON, add module.exports for testability Tests: - 55 new tests for ManagedTimer (js/__tests__/ManagedTimer.test.js, 497 lines) - 4 new tests for Publisher.dataToTags (planet/js/__tests__/Publisher.test.js) - All 112 test suites pass (3167 tests, 0 failures) Fixes zombie timer bug in the core execution engine.
1 parent f488f0b commit 6f2bcf3

File tree

6 files changed

+1397
-211
lines changed

6 files changed

+1397
-211
lines changed

0 commit comments

Comments
 (0)