fix: remove async lock polling in Duplicate and Arpeggio flows (Fix #6882)#6883
fix: remove async lock polling in Duplicate and Arpeggio flows (Fix #6882)#6883gcharpe1604 wants to merge 3 commits into
Conversation
|
✅ All Jest tests passed! This PR is ready to merge. Coverage: Statements: 44.81% | Branches: 36.32% | Functions: 49.85% | Lines: 45.25% |
|
i stronly think your reasoning is right given javascript is single threaded so that settimeout pollin was nevera cutally doing anything usefull |
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Coverage: Statements: 45.15% | Branches: 36.5% | Functions: 50.5% | Lines: 45.58% Failed Tests: |
64b9cda to
4290bcb
Compare
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Coverage: Statements: 45.14% | Branches: 36.48% | Functions: 50.5% | Lines: 45.58% Failed Tests: |
|
✅ All Jest tests passed! This PR is ready to merge. Coverage: Statements: 45.14% | Branches: 36.48% | Functions: 50.5% | Lines: 45.58% |
|
@Ashutoshx7 Thanks for the review! Also pushed 97c8b64 to fix the planetInterface.test.js CI failure, unrelated to the core change, but stage.update(event) on line 223 of planetInterface.js was passing undefined as an argument (stray event reference with no DOM context). Cleaned that up so all 29 tests pass. All checks are green now. Ready for final review. |
|
This PR has merge conflicts with Please rebase your branch: # Add upstream remote (one-time setup)
git remote add upstream https://github.com/sugarlabs/musicblocks.git
# Fetch latest master and rebase
git fetch upstream
git rebase upstream/master
# Resolve any conflicts, then:
git push --force-with-lease origin YOUR_BRANCH
|
97c8b64 to
08e0d71
Compare
Removed __acquireLock polling mechanism from FlowBlocks.js and IntervalsBlocks.js. Converted __listener functions to execute synchronously to prevent lock contention across task boundaries in the single-threaded execution environment.
The if (connectionStoreLock) + console.warn pattern was confusing since the lock is never expected to be held at either point in a synchronous single-threaded flow. Matches the direct assignment style used elsewhere per reviewer suggestion.
08e0d71 to
c8f0a9e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6883 +/- ##
==========================================
- Coverage 59.28% 59.27% -0.01%
==========================================
Files 176 176
Lines 57967 57935 -32
==========================================
- Hits 34365 34341 -24
+ Misses 23602 23594 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Rebased this PR onto the latest Current status:
The earlier reviewer suggestion to remove the warning/forced-acquisition guard and use the synchronous direct-assignment pattern remains preserved. Ready for final review. |
Description
This PR removes the asynchronous lock-polling mechanism from the
DuplicateBlockandArpeggioBlockexecution paths.The affected connection-store critical sections are fully synchronous. Polling with
setTimeout()and awaiting lock acquisition introduced unnecessary event-loop boundaries while the lock remained held, and the fallback eventually force-acquired the same boolean lock.The listeners and main flow now use the existing synchronous critical-section pattern, with
try/finallyensuring thatlogo.connectionStoreLockis always released.Related Issue
Fixes #6882.
PR Category
Changes Made
__acquireLock()polling fromDuplicateBlock.__acquireLock()polling fromArpeggioBlock.finallyblocks.Safety Validation
The affected critical sections were checked for asynchronous yield points.
The following operations are synchronous:
setTurtleListenerfindBottomBlock__lookForOtherTurtlesThere are no promises, awaited calls, timers, asynchronous functions, or callback registration inside the critical sections.
This safety assumption should be revisited if asynchronous work is added to these paths in the future.
Testing Performed
Result: 187 tests passed
Additional checks:
git diff --checkpassedChecklist