Skip to content

Commit 671cf33

Browse files
committed
Only update hash if changed.
1 parent 79d11d1 commit 671cf33

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class ExportHelper {
2626
return isoTimestamp.replace('T', ' ').replace(/\.\d*Z/, '');
2727
}
2828

29-
static async updateExportMeta(currentHash = '') {
29+
static async updateExportMeta() {
3030
const hasher = createHash('sha256');
3131
const files = await readdir(ExportHelper.dataDir);
3232
for (const file of files) {
@@ -37,8 +37,10 @@ export class ExportHelper {
3737
}
3838
const hash = hasher.digest('hex');
3939

40+
const { hash: previousHash } = await ExportHelper.getExportMeta() || {};
41+
4042
// Only update hash file if it has changed
41-
if (hash === currentHash) return false;
43+
if (hash === previousHash) return false;
4244

4345
const ts = ExportHelper.utcTS();
4446
const txt = hash + '@' + ts;

0 commit comments

Comments
 (0)