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
|
@ -33,6 +33,7 @@ const utils = require('../../utils/utils.js')
|
|||
const actions = require('../../utils/actions.js')
|
||||
const dbtools = require('../../utils/dbtools.js')
|
||||
const auth = require('../../middlewares/auth.middleware.js')
|
||||
const { searchData } = require('../../utils/classes.js')
|
||||
|
||||
// files
|
||||
const searchDataWorkerFile = './src/utils/searchData.js'
|
||||
|
@ -762,42 +763,49 @@ function GetApp() {
|
|||
)
|
||||
}
|
||||
|
||||
const worker = new Worker(searchDataWorkerFile, {
|
||||
workerData: {
|
||||
data,
|
||||
question,
|
||||
subj,
|
||||
recData,
|
||||
},
|
||||
})
|
||||
// const worker = new Worker(searchDataWorkerFile, {
|
||||
// workerData: {
|
||||
// data,
|
||||
// question,
|
||||
// subj,
|
||||
// recData,
|
||||
// },
|
||||
// })
|
||||
|
||||
worker.on('error', (err) => {
|
||||
logger.Log('Search Data Worker error!', logger.GetColor('redbg'))
|
||||
console.error(err)
|
||||
// TODO: handle error
|
||||
})
|
||||
// worker.on('error', (err) => {
|
||||
// logger.Log('Search Data Worker error!', logger.GetColor('redbg'))
|
||||
// console.error(err)
|
||||
// // TODO: handle error
|
||||
// })
|
||||
|
||||
worker.on('exit', (code) => {
|
||||
logger.DebugLog('Search Data exit, code: ' + code, 'actions', 1)
|
||||
if (code !== 0) {
|
||||
logger.Log(
|
||||
'Search Data Worker error! Exit code is not 0',
|
||||
logger.GetColor('redbg')
|
||||
)
|
||||
// TODO: handle error
|
||||
}
|
||||
})
|
||||
// worker.on('exit', (code) => {
|
||||
// logger.DebugLog('Search Data exit, code: ' + code, 'actions', 1)
|
||||
// if (code !== 0) {
|
||||
// logger.Log(
|
||||
// 'Search Data Worker error! Exit code is not 0',
|
||||
// logger.GetColor('redbg')
|
||||
// )
|
||||
// // TODO: handle error
|
||||
// }
|
||||
// })
|
||||
|
||||
// let result = data.Search(question, subj, recData)
|
||||
worker.on('message', (workerMsg) => {
|
||||
const result = workerMsg
|
||||
res.json({
|
||||
result: result,
|
||||
success: true,
|
||||
})
|
||||
logger.DebugLog(`Question result length: ${result.length}`, 'ask', 1)
|
||||
logger.DebugLog(result, 'ask', 2)
|
||||
// // let result = data.Search(question, subj, recData)
|
||||
// worker.on('message', (workerMsg) => {
|
||||
// const result = workerMsg
|
||||
// res.json({
|
||||
// result: result,
|
||||
// success: true,
|
||||
// })
|
||||
// logger.DebugLog(`Question result length: ${result.length}`, 'ask', 1)
|
||||
// logger.DebugLog(result, 'ask', 2)
|
||||
// })
|
||||
let result = searchData(data, question, subj, recData)
|
||||
res.json({
|
||||
result: result,
|
||||
success: true,
|
||||
})
|
||||
logger.DebugLog(`Question result length: ${result.length}`, 'ask', 1)
|
||||
logger.DebugLog(result, 'ask', 2)
|
||||
} else {
|
||||
logger.DebugLog(`Invalid question`, 'ask', 1)
|
||||
res.json({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue