You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.error(`[Master] .workerServicesReady() Could not find worker ID ${nWorkerID} key in this.objWorkerIDToState to set the .ready=true. Retrying after 10 seconds sleep in case race condition.`);
312
+
awaitsleep(10*1000);
313
+
314
+
if(!this.objWorkerIDToState[nWorkerID])
315
+
{
316
+
console.error(`[Master] .workerServicesReady() Could not find worker ID ${nWorkerID} key in this.objWorkerIDToState to set the .ready=true. Going berserk and marking all as ready. this.objWorkerIDToState: ${JSON.stringify(this.objWorkerIDToState,undefined," ")}`);
317
+
318
+
for(const_nWorkerIDinthis.objWorkerIDToState)
319
+
{
320
+
this.objWorkerIDToState[_nWorkerID].ready=true;
321
+
}
322
+
323
+
return;
324
+
}
325
+
else
326
+
{
327
+
console.error(`[Master] .workerServicesReady() Found worker ID ${nWorkerID} key in this.objWorkerIDToState to set the .ready=true. This indicates a race condition exists somewhere.`);
Copy file name to clipboardExpand all lines: src/NodeMultiCoreCPUBase/WorkerEndpoint.js
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,8 @@ class WorkerEndpoint extends JSONRPC.EndpointBase
41
41
this._promiseStart=null;
42
42
43
43
this._nPersistentWorkerID=undefined;
44
+
45
+
this._bAlreadyDelayedReadingWorkerID=false;
44
46
}
45
47
46
48
@@ -72,7 +74,7 @@ class WorkerEndpoint extends JSONRPC.EndpointBase
72
74
73
75
74
76
/**
75
-
* @returns {JSONRPC.Client}
77
+
* @returns {JSONRPC.Client|null}
76
78
*/
77
79
getmasterClient()
78
80
{
@@ -96,7 +98,8 @@ class WorkerEndpoint extends JSONRPC.EndpointBase
96
98
this.start().catch(console.error);
97
99
}
98
100
99
-
thrownewError("The .masterClient property was not initialized by .start().");
101
+
console.error("[jsornpc-bidirectional] [WorkerEndpoint] The .masterClient property was not initialized by .start(). Returning null.",newError().stack);
102
+
returnnull;
100
103
}
101
104
102
105
returnthis._masterClient;
@@ -168,7 +171,13 @@ class WorkerEndpoint extends JSONRPC.EndpointBase
168
171
thrownewError("WorkerEndpoint.start() was already called.");
0 commit comments