mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added some logs, ask test script encodes JSON uri component
This commit is contained in:
parent
1aa5c7eef4
commit
45962874fd
4 changed files with 9 additions and 2 deletions
|
@ -23,6 +23,9 @@ elif [ "$#" -eq 2 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
../bin/hr.sh
|
../bin/hr.sh
|
||||||
|
|
||||||
|
data=$(node -e "console.log(encodeURIComponent('$data'));")
|
||||||
|
|
||||||
echo sending
|
echo sending
|
||||||
echo "Question: $q"
|
echo "Question: $q"
|
||||||
echo "Data: $data"
|
echo "Data: $data"
|
||||||
|
|
|
@ -170,7 +170,7 @@ function ProcessIncomingRequest(recievedData, qdb, infos, dryRun, user) {
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
logger.Log('Couldnt parse JSON data', logger.GetColor('redbg'))
|
logger.Log('There was en error handling incoming quiz data, see stderr', logger.GetColor('redbg'))
|
||||||
reject(new Error('Couldnt parse JSON data'))
|
reject(new Error('Couldnt parse JSON data'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -297,6 +297,7 @@ function searchQuestion(subj, question, questionData, subjName) {
|
||||||
subj.Name,
|
subj.Name,
|
||||||
questionData
|
questionData
|
||||||
)
|
)
|
||||||
|
|
||||||
if (percent.avg > minMatchAmmount) {
|
if (percent.avg > minMatchAmmount) {
|
||||||
result.push({
|
result.push({
|
||||||
q: currentQuestion,
|
q: currentQuestion,
|
||||||
|
@ -405,6 +406,8 @@ function searchData(data, question, subjName, questionData) {
|
||||||
})
|
})
|
||||||
|
|
||||||
worker.on('message', (result) => {
|
worker.on('message', (result) => {
|
||||||
|
logger.DebugLog(`Worker message arrived`, 'worker', 2)
|
||||||
|
logger.DebugLog(result, 'worker', 3)
|
||||||
logger.DebugLog(`Question result length: ${result.length}`, 'ask', 1)
|
logger.DebugLog(`Question result length: ${result.length}`, 'ask', 1)
|
||||||
logger.DebugLog(result, 'ask', 2)
|
logger.DebugLog(result, 'ask', 2)
|
||||||
|
|
||||||
|
@ -453,6 +456,7 @@ function dataToString(data) {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
if (!isMainThread) {
|
if (!isMainThread) {
|
||||||
|
logger.DebugLog(`Starting search worker ...`, 'worker', 1)
|
||||||
const { data, subjName, question, questionData } = workerData
|
const { data, subjName, question, questionData } = workerData
|
||||||
let result = []
|
let result = []
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6bc51fb3878564012ce7af1a75b7fa049ab5f3c5
|
Subproject commit 760dfb0c4ec005dbd496d772c7a5278cfa5071bc
|
Loading…
Add table
Add a link
Reference in a new issue