Skip to content

Commit 08e0d71

Browse files
committed
fix: drop warn guard from listener and flow lock acquisition
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.
1 parent 169c10e commit 08e0d71

2 files changed

Lines changed: 0 additions & 30 deletions

File tree

js/blocks/FlowBlocks.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,7 @@ function setupFlowBlocks(activity) {
202202
tur.singer.inDuplicate = false;
203203
tur.singer.duplicateFactor /= factor;
204204

205-
if (logo.connectionStoreLock) {
206-
console.warn(
207-
"connectionStoreLock: Lock already held in DuplicateBlock listener, forcing acquisition"
208-
);
209-
}
210205
logo.connectionStoreLock = true;
211-
212206
try {
213207
// The last turtle should restore the broken connections
214208
if (__lookForOtherTurtles(blk, turtle) === null) {
@@ -231,15 +225,6 @@ function setupFlowBlocks(activity) {
231225
// Set the turtle listener
232226
logo.setTurtleListener(turtle, listenerName, __listener);
233227

234-
// Acquire lock for the main flow
235-
// JavaScript is single-threaded, so if the lock is held here it means
236-
// a previous critical section did not release it (likely due to an error).
237-
// We warn and force-acquire since no spin-wait can help in a single thread.
238-
if (logo.connectionStoreLock) {
239-
console.warn(
240-
"connectionStoreLock: Lock already held in DuplicateBlock flow, forcing acquisition"
241-
);
242-
}
243228
logo.connectionStoreLock = true;
244229

245230
try {

js/blocks/IntervalsBlocks.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -811,13 +811,7 @@ function setupIntervalsBlocks(activity) {
811811
tur.singer.duplicateFactor /= factor;
812812
tur.singer.arpeggio = [];
813813

814-
if (logo.connectionStoreLock) {
815-
console.warn(
816-
"connectionStoreLock: Lock already held in ArpeggioBlock listener, forcing acquisition"
817-
);
818-
}
819814
logo.connectionStoreLock = true;
820-
821815
try {
822816
// The last turtle should restore the broken connections.
823817
if (__lookForOtherTurtles(blk, turtle) === null) {
@@ -839,15 +833,6 @@ function setupIntervalsBlocks(activity) {
839833

840834
logo.setTurtleListener(turtle, listenerName, __listener);
841835

842-
// Acquire lock for the main flow
843-
// JavaScript is single-threaded, so if the lock is held here it means
844-
// a previous critical section did not release it (likely due to an error).
845-
// We warn and force-acquire since no spin-wait can help in a single thread.
846-
if (logo.connectionStoreLock) {
847-
console.warn(
848-
"connectionStoreLock: Lock already held in ArpeggioBlock flow, forcing acquisition"
849-
);
850-
}
851836
logo.connectionStoreLock = true;
852837

853838
try {

0 commit comments

Comments
 (0)