-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: deno assumes relative path for worker (#3)
Fixes #2 * bugfix: deno assumes relative path for worker * add a log * try using URL() * Update mod.ts * chore: remove test import * chore: test dirname * Update connector.ts * Update README.md * chore: remove test console.log Co-authored-by: Aditi Mohanty <[email protected]>
- Loading branch information
1 parent
acb4328
commit e36505d
Showing
2 changed files
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { dirname, join } from "https://deno.land/[email protected]/path/mod.ts" | ||
import { readJson } from "https://deno.land/std/fs/read_json.ts"; | ||
import { writeJson } from "https://deno.land/std/fs/write_json.ts"; | ||
|
||
|
@@ -10,7 +11,7 @@ const getNow = Date.now; | |
export class Connector<Schema = any> { | ||
private _filePath: string = ""; | ||
private readonly WRITE_TIMEOUT: number = 10000; | ||
private readonly WRITE_WORKER_PATH: string = "./writeWorker.ts"; | ||
private readonly WRITE_WORKER_PATH: string = join(dirname(import.meta.url), "writeWorker.ts"); | ||
private readonly WRITE_WORKER_OPTIONS: { type: "module"; deno: boolean } = { | ||
type: "module", | ||
deno: true, | ||
|
@@ -76,7 +77,10 @@ export class Connector<Schema = any> { | |
} else if (error) { | ||
reject(error); | ||
} else { | ||
console.debug("[casualdb:connector:debug]", { returnedTaskId, taskId, error }); | ||
console.debug( | ||
"[casualdb:connector:debug]", | ||
{ returnedTaskId, taskId, error }, | ||
); | ||
reject(new Error(`[casualdb] unknown error while writing to file`)); | ||
} | ||
if (timeout) { | ||
|