no need to read log records
This commit is contained in:
parent
695c74588f
commit
3e245af50c
@ -1,10 +1,7 @@
|
||||
import { TAbstractFile, TFolder, TFile, Vault } from "obsidian";
|
||||
|
||||
import type { SyncPlanType } from "./sync";
|
||||
import {
|
||||
readAllSyncPlanRecordTextsByVault,
|
||||
readAllLogRecordTextsByVault,
|
||||
} from "./localdb";
|
||||
import { readAllSyncPlanRecordTextsByVault } from "./localdb";
|
||||
import type { InternalDBs } from "./localdb";
|
||||
import { mkdirpInVault } from "./misc";
|
||||
import {
|
||||
|
||||
@ -649,31 +649,6 @@ export const clearExpiredSyncPlanRecords = async (db: InternalDBs) => {
|
||||
await Promise.all(ps);
|
||||
};
|
||||
|
||||
export const readAllLogRecordTextsByVault = async (
|
||||
db: InternalDBs,
|
||||
vaultRandomID: string
|
||||
) => {
|
||||
const records = [] as { ts: number; r: string }[];
|
||||
await db.loggerOutputTbl.iterate((value, key, iterationNumber) => {
|
||||
if (key.startsWith(`${vaultRandomID}\t`)) {
|
||||
const item = {
|
||||
ts: parseInt(key.split("\t")[1]),
|
||||
r: value as string,
|
||||
};
|
||||
records.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
// while reading the logs, we want it to be ascending
|
||||
records.sort((a, b) => a.ts - b.ts);
|
||||
|
||||
if (records === undefined) {
|
||||
return [] as string[];
|
||||
} else {
|
||||
return records.map((x) => x.r);
|
||||
}
|
||||
};
|
||||
|
||||
export const clearAllLoggerOutputRecords = async (db: InternalDBs) => {
|
||||
await db.loggerOutputTbl.clear();
|
||||
log.debug(`successfully clearAllLoggerOutputRecords`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user