mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2026-04-28 11:17:38 +02:00
Domain specific data files
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user