mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
qdb data path fix
This commit is contained in:
parent
773e7eda0b
commit
c295781b48
4 changed files with 31 additions and 26 deletions
|
@ -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(
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue