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>,
|
dataFiles: Array<DataFile>,
|
||||||
dataDir: string
|
dataDir: string
|
||||||
): Array<QuestionDb> {
|
): 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
|
const dataPath = dataDir + dataFile.path
|
||||||
|
|
||||||
if (!utils.FileExists(dataPath)) {
|
if (!utils.FileExists(dataPath)) {
|
||||||
|
@ -514,6 +515,7 @@ export function loadJSON(
|
||||||
try {
|
try {
|
||||||
acc.push({
|
acc.push({
|
||||||
...dataFile,
|
...dataFile,
|
||||||
|
path: dataPath,
|
||||||
index: index,
|
index: index,
|
||||||
data: loadData(dataPath),
|
data: loadData(dataPath),
|
||||||
})
|
})
|
||||||
|
@ -525,7 +527,9 @@ export function loadJSON(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, [])
|
},
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
||||||
const { subjCount, questionCount } = countOfQdbs(res)
|
const { subjCount, questionCount } = countOfQdbs(res)
|
||||||
logger.Log(
|
logger.Log(
|
||||||
|
|
|
@ -28,7 +28,8 @@ import logger from '../utils/logger'
|
||||||
|
|
||||||
import { paths } from './files'
|
import { paths } from './files'
|
||||||
|
|
||||||
const writeInterval = 1
|
// TODO: on process exit write all
|
||||||
|
const writeInterval = 20
|
||||||
|
|
||||||
let idStatsData = {}
|
let idStatsData = {}
|
||||||
let idvStatsData = {}
|
let idvStatsData = {}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import { paths } from './files'
|
||||||
const colors = ['green', 'red', 'yellow', 'blue', 'magenta', 'cyan']
|
const colors = ['green', 'red', 'yellow', 'blue', 'magenta', 'cyan']
|
||||||
const logFileName = 'log'
|
const logFileName = 'log'
|
||||||
|
|
||||||
|
// TODO: on process exit write all
|
||||||
const writeInterval = 10
|
const writeInterval = 10
|
||||||
const debugLevel = parseInt(process.env.NS_LOGLEVEL) || 0
|
const debugLevel = parseInt(process.env.NS_LOGLEVEL) || 0
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,6 @@ export const handleQuestionsToPeers = async (
|
||||||
|
|
||||||
if (res.error || !res.data?.success) {
|
if (res.error || !res.data?.success) {
|
||||||
results.errors.push(peer)
|
results.errors.push(peer)
|
||||||
console.error('AAAAAAAAAAAAAAAAAAAAAAA')
|
|
||||||
console.error(res.error || JSON.stringify(res.data))
|
console.error(res.error || JSON.stringify(res.data))
|
||||||
} else if (res.data?.totalNewQuestions > 0) {
|
} else if (res.data?.totalNewQuestions > 0) {
|
||||||
results.hasNew.push(peer)
|
results.hasNew.push(peer)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue