Closed namnguyen279 closed 5 years ago
Hi @traubo279,
F.worker()
returns executes only one instance of worker and it returns child_process
object. If you want to execute multiple same workers then you need to use WORKER2()
.
Hi @traubo279,
F.worker()
returns executes only one instance of worker and it returnschild_process
object. If you want to execute multiple same workers then you need to useWORKER2()
.
Hi @petersirka, in my case, both F.worker and F.worker2 do return the child_process object but don't execute anything inside the source worker file on version 3.2.4, i tried reinstall from npm and it doesnt work. Finally i reversed to 3.1.0 and it work. Node version tested on 8.9.1 and 11.5.0.
Can you send me two examples with v3.2.4
and v3.1.0
? I'll test it.
Here is my code in folder definitions/cron.js
function repeat () {
let cc = F.worker("a", "worker")
console.log("worker should be executed");
}
setInterval(repeat, 5000);
F.once('load', repeat);
and a simple in folder workers/a.js with
console.log('message from worker')
Output on 3.1.0:
Output on 3.2.4:
Hi. I have changed behaviour for workers. Each worker has been executed in silent
mode. But I have updated core of Total.js:
allow_workers_silent : false
false
as you expect (same like in v3.1.0
version)$ npm install total.js@beta
I'm not sure if this new behaviour is OK but it's better.
Hi @petersirka, it seem to work fine if allow_workers_silent
is not exist or missing from the config file. Manually set it to false will result the same as set it to true in the config file.
Hi @traubo279 , by default is false
... I have tested it and it works correctly. For F.worker2()
is set to true
(this can't be changed) because the reason is pipe
between app and child process and worker2
executes a callback with the response from the stdout
stream.
@petersirka, yes i know it working on default, but when i have"allow_workers_silent : false"
in config, it's the same as "allow_workers_silent : true"
, which is may be miss leading to some people .. ;)
True, I have fixed it. Thank you. New beta will be released next week.
It seem that F.worker does not execute workers even one with a simple console.log on current 3.2.4