qdb data path fix

This commit is contained in:
mrfry 2023-04-26 22:04:34 +02:00
parent 773e7eda0b
commit c295781b48
4 changed files with 31 additions and 26 deletions

View file

@ -500,7 +500,8 @@ export function loadJSON(
dataFiles: Array<DataFile>,
dataDir: string
): Array<QuestionDb> {
const res: Array<QuestionDb> = dataFiles.reduce((acc, dataFile, index) => {
const res: Array<QuestionDb> = dataFiles.reduce(
(acc: QuestionDb[], dataFile, index) => {
const dataPath = dataDir + dataFile.path
if (!utils.FileExists(dataPath)) {
@ -514,6 +515,7 @@ export function loadJSON(
try {
acc.push({
...dataFile,
path: dataPath,
index: index,
data: loadData(dataPath),
})
@ -525,7 +527,9 @@ export function loadJSON(
)
}
return acc
}, [])
},
[]
)
const { subjCount, questionCount } = countOfQdbs(res)
logger.Log(

View file

@ -28,7 +28,8 @@ import logger from '../utils/logger'
import { paths } from './files'
const writeInterval = 1
// TODO: on process exit write all
const writeInterval = 20
let idStatsData = {}
let idvStatsData = {}

View file

@ -31,6 +31,7 @@ import { paths } from './files'
const colors = ['green', 'red', 'yellow', 'blue', 'magenta', 'cyan']
const logFileName = 'log'
// TODO: on process exit write all
const writeInterval = 10
const debugLevel = parseInt(process.env.NS_LOGLEVEL) || 0

View file

@ -115,7 +115,6 @@ export const handleQuestionsToPeers = async (
if (res.error || !res.data?.success) {
results.errors.push(peer)
console.error('AAAAAAAAAAAAAAAAAAAAAAA')
console.error(res.error || JSON.stringify(res.data))
} else if (res.data?.totalNewQuestions > 0) {
results.hasNew.push(peer)