Domain specific data files

This commit is contained in:
mrfry 2020-12-22 16:11:01 +01:00
parent 81577ad621
commit f87e165084
9 changed files with 174 additions and 71 deletions

View file

@ -27,7 +27,7 @@ export function doALongTask(obj: any): Promise<any> {
resolve(res)
// TODO: check if result is really a result, and want to release port
pool.release(client)
console.log('[RELEASE]: #' + client.index)
// console.log('[RELEASE]: #' + client.index)
})
})
.catch(function(err) {
@ -56,9 +56,9 @@ export function initWorkerPool(initData: any): void {
}
},
destroy: function(client) {
console.log('[DESTROY]')
// console.log('[DESTROY]')
client.worker.terminate()
console.log('[DESTROYED] #' + client.index)
// console.log('[DESTROYED] #' + client.index)
},
}
@ -115,9 +115,9 @@ function getAWorker(i, initData) {
// ---------------------------------------------------------------------------
function doSomething(client, obj) {
const { index, worker } = client
const { /* index, */ worker } = client
return new Promise((resolve) => {
console.log('[ACCUIRE]: #' + index)
// console.log('[ACCUIRE]: #' + index)
worker.postMessage(obj)
worker.once('message', (msg) => {
resolve(msg)