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
Hi, I'm trying to train a neural network with brain.js in a thread (using Node v20, I tried v18 as well), and I can't seem to get updates from the Observable until the entire thread has finished it's work... I've reproduced the issue in the simplest form here:
// worker.jsimport{expose}from"threads/worker"import{Observable}from"observable-fns"expose({longRunningCode(){returnnewObservable(observer=>{observer.next("Started")for(leti=0;i<5;i++){observer.next("Progress "+i)letstartedAt=Date.now()while(Date.now()-startedAt<1000){/* long running code */}}observer.next("Completed")observer.complete()})}})
I would expect to see Progress 0, Progress 1 etc appearing 1 second apart in the console log. Instead, nothing happens for 5 seconds and then I get all the logs at once at the end...
I'm not sure if I'm doing something wrong, or if this is a bug?
The text was updated successfully, but these errors were encountered:
Hi, I'm trying to train a neural network with brain.js in a thread (using Node v20, I tried v18 as well), and I can't seem to get updates from the Observable until the entire thread has finished it's work... I've reproduced the issue in the simplest form here:
I would expect to see Progress 0, Progress 1 etc appearing 1 second apart in the console log. Instead, nothing happens for 5 seconds and then I get all the logs at once at the end...
I'm not sure if I'm doing something wrong, or if this is a bug?
The text was updated successfully, but these errors were encountered: