1
0
forked from apxtri/apxtri

reindex auto on start

This commit is contained in:
philc 2024-08-07 08:02:47 +02:00
parent 57db217ee4
commit 53fad87b25
2 changed files with 34 additions and 26 deletions

View File

@ -7,6 +7,7 @@ const path = require("path");
const cors = require("cors");
const express = require("express");
const process = require("process");
const Odmdb = require("./models/Odmdb.js");
/*******************************************
SEE README.md to have a quick start
@ -40,6 +41,13 @@ tribeIds.forEach((t) => {
tribelist[t].dns.forEach((d) => {
const dm = d.split(".").slice(-2).join(".");
if (!doms.includes(dm)) doms.push(dm);
//reindex database
if (t == "smatchit") {
glob.sync(`../../${t}/objects/*`).forEach(o => {
console.log(t, o)
Odmdb.runidx(o)
})
}
});
const context = {};
const pathtr = path.resolve(`../../${t}`);

View File

@ -900,7 +900,7 @@ Odmdb.runidx = (objectPathname, schema) => {
});
Object.keys(ventil).forEach((n) => {
//if (log) console.log(currentmod,`${objectPathname}/idx/${ventil[n].name}.json`)
fs.outputJSON(
fs.outputJSONSync(
`${objectPathname}/idx/${ventil[n].name}.json`,
ventil[n].data
);