Skip to content

Commit c68d481

Browse files
committed
typescript issues
1 parent f331a8d commit c68d481

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/packages/backend/conat/test/persist/backup-archive.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Testing automatic tiered storage and backup persistence functionality.
55
import {
66
before,
77
after,
8-
connect,
98
delay,
109
client,
1110
wait,
@@ -16,7 +15,6 @@ import { pathExists } from "fs-extra";
1615
import { join } from "path";
1716
import * as fs from "fs/promises";
1817
import { messageData } from "@cocalc/conat/core/client";
19-
import { executeCode } from "@cocalc/backend/execute-code";
2018
import sqlite from "better-sqlite3";
2119
import { openPaths } from "@cocalc/conat/persist/storage";
2220

@@ -89,11 +87,6 @@ describe("create persist server that also saves data to an archive folder and a
8987
// at this point the actual sqlite3 database should be closed
9088
});
9189

92-
const sha1 = async (path) => {
93-
const { stdout } = await executeCode({ command: "sha1sum", args: [path] });
94-
return stdout;
95-
};
96-
9790
it("the backup, archive, and local files should all be identical as sqlite database", async () => {
9891
// they are not the same as files though so we need some care to compare them.
9992
expect(await serialize(local)).toEqual(await serialize(backup));

src/packages/conat/persist/storage.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ export class PersistentStream extends EventEmitter {
330330
};
331331

332332
close = async () => {
333-
logger.debug("close ", this.options.path);
333+
const path = this.options?.path;
334+
if (path == null) {
335+
return;
336+
}
337+
logger.debug("close ", path);
334338
if (this.db != null) {
335339
this.vacuum();
336340
this.db.prepare("PRAGMA wal_checkpoint(FULL)").run();
@@ -345,7 +349,7 @@ export class PersistentStream extends EventEmitter {
345349
this.msgIDs?.clear();
346350
// @ts-ignore
347351
delete this.msgIDs;
348-
openPaths.delete(options.path);
352+
openPaths.delete(path);
349353
};
350354

351355
private backup = reuseInFlight(async (path?: string): Promise<void> => {

0 commit comments

Comments
 (0)