mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Fixed bugs that came from declassifying classes.js
This commit is contained in:
parent
db1976ecf3
commit
ecd3a9805f
6 changed files with 92 additions and 116 deletions
|
@ -1,22 +1,16 @@
|
|||
const { isMainThread, parentPort, workerData } = require('worker_threads')
|
||||
const logger = require('../utils/logger.js')
|
||||
const actions = require('../utils/actions.js')
|
||||
const { searchData } = require('../../utils/classes.js')
|
||||
|
||||
if (!isMainThread) {
|
||||
logger.DebugLog('Starting worker thread', 'searchdata', 1)
|
||||
logger.DebugLog(workerData, 'searchdata', 1)
|
||||
logger.DebugLog(workerData, 'searchdata', 3)
|
||||
const { data, question, subj, recData } = workerData
|
||||
|
||||
parentPort.postMessage(
|
||||
SearchData(actions.LoadJSONFromObject(data), question, subj, recData)
|
||||
)
|
||||
parentPort.postMessage(searchData(data, question, subj, recData))
|
||||
} else {
|
||||
logger.Log(
|
||||
'Porcess data should not run on main thread!',
|
||||
logger.GetColor('redbg')
|
||||
)
|
||||
}
|
||||
|
||||
function SearchData(data, question, subj, recData) {
|
||||
return data.Search(question, subj, recData)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue