profile refactoring, fixes

This commit is contained in:
Jan Prochazka
2022-12-18 17:03:47 +01:00
parent 3bbdc56309
commit 0ff4f0d7e9
4 changed files with 42 additions and 41 deletions

View File

@@ -101,13 +101,14 @@ module.exports = {
// },
async ensureDatastore(jslid, formatterFunction) {
const rowFormatter = requirePluginFunction(formatterFunction);
const dskey = `${jslid}||${formatterFunction}`;
let datastore = this.datastores[dskey];
if (!datastore) {
datastore = new JsonLinesDatastore(getJslFileName(jslid), rowFormatter);
let datastore = this.datastores[jslid];
if (!datastore || datastore.formatterFunction != formatterFunction) {
if (datastore) {
datastore._closeReader();
}
datastore = new JsonLinesDatastore(getJslFileName(jslid), formatterFunction);
// datastore = new DatastoreProxy(getJslFileName(jslid));
this.datastores[dskey] = datastore;
this.datastores[jslid] = datastore;
}
return datastore;
},