some-random-actions-modification

This commit is contained in:
mrfry 2020-09-12 12:56:15 +02:00
parent c7fafa0789
commit 6ea0263b02
3 changed files with 100 additions and 98 deletions

@ -1 +1 @@
Subproject commit 7ac65348e41463670fc303fffc788f0baa03d288 Subproject commit ada93f0bb9b87863e04130e2db77ca52e8087058

@ -1 +1 @@
Subproject commit cbaaa7a376a9ac40e95b534c8a1181a017e95ddd Subproject commit f8d4bf2a414d2973582c08bfa8b8b8f19389b2e9

View file

@ -39,10 +39,11 @@ const writeAfter = 1 // write after # of adds FIXME: set reasonable save rate
var currWrites = 0 var currWrites = 0
function ProcessIncomingRequest (recievedData, qdb, infos, dryRun) { function ProcessIncomingRequest (recievedData, qdb, infos, dryRun) {
return new Promise((resolve, reject) => {
logger.DebugLog('Processing incoming request', 'actions', 1) logger.DebugLog('Processing incoming request', 'actions', 1)
if (recievedData === undefined) { if (recievedData === undefined) {
logger.Log('\tRecieved data is undefined!', logger.GetColor('redbg')) logger.Log('\tRecieved data is undefined!', logger.GetColor('redbg'))
return reject(new Error('Recieved data is undefined!'))
} }
try { try {
@ -140,12 +141,13 @@ function ProcessIncomingRequest (recievedData, qdb, infos, dryRun) {
logger.DebugLog(allQuestions, 'actions', 2) logger.DebugLog(allQuestions, 'actions', 2)
logger.DebugLog('ProcessIncomingRequest done', 'actions', 1) logger.DebugLog('ProcessIncomingRequest done', 'actions', 1)
return allQuestions.length resolve(allQLength.length)
} catch (e) { } catch (e) {
console.log(e) console.log(e)
logger.Log('Couldnt parse JSON data', logger.GetColor('redbg')) logger.Log('Couldnt parse JSON data', logger.GetColor('redbg'))
return -1 reject(new Error('Couldnt parse JSON data'))
} }
})
} }
// loading stuff // loading stuff