Skip to content

Commit aa51689

Browse files
committed
fix: reorder in-pg initialization to load files first
1 parent 9532b1a commit aa51689

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@inspatial/cloud",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"license": "Apache-2.0",
55
"exports": {
66
".": "./mod.ts",

src/orm/db/postgres/in-pg/in-pg-client.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ import type { Output, OutputMore } from "./types.ts";
88

99
export class InPGClient extends PostgresClient {
1010
#inPg: InPG;
11-
wasmPath: string;
1211
constructor(options: PgClientConfig) {
1312
super(options);
1413
const thisDir = normalizePath(import.meta.dirname || "");
1514
const inRoot = Deno.env.get("IN_ROOT");
1615
const pgDataRoot = normalizePath(`${inRoot}/pgdata`);
17-
this.wasmPath = `${thisDir}/src/inpg.wasm`;
1816

1917
this.#inPg = new InPG({
2018
env: {
@@ -32,7 +30,7 @@ export class InPGClient extends PostgresClient {
3230
onStdout: (out) => {
3331
console.log(out.message);
3432
},
35-
debug: false,
33+
debug: options.debug,
3634
args: [
3735
"--single",
3836
"postgres",

src/orm/db/postgres/in-pg/in-pg.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export class InPG implements Deno.Conn {
151151

152152
async run() {
153153
await this.loadRemoteFiles();
154+
this.fileManager.init();
154155
await this.#setup();
155156
await this.initRuntime();
156157
this.#callMain(this.args);

src/orm/db/postgres/in-pg/src/fileManager/in-pg-files.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export class FileManager {
3434
this.openFiles = new Map();
3535
this.openTmpFDs = new Map();
3636
this.postgresFiles = new Map();
37-
this.clearTmp();
3837

3938
this.tmpMap = new Map();
4039
if (this.debug) {
@@ -44,6 +43,9 @@ export class FileManager {
4443
truncate: true,
4544
});
4645
}
46+
}
47+
init() {
48+
this.clearTmp();
4749
this.loadPostgresFiles();
4850
this.setupStdStreams();
4951
}
@@ -412,7 +414,7 @@ export class FileManager {
412414
}
413415
return null;
414416
}
415-
async loadPostgresFiles() {
417+
loadPostgresFiles() {
416418
const data = this.inPg.fileData;
417419
let offset = 0;
418420
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);

0 commit comments

Comments
 (0)