Skip to content

Commit 5171a13

Browse files
committed
fix(dialect-sqlite-worker): fix incorrect type import and unless await
1 parent 776555f commit 5171a13

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

packages/dialect-sqlite-worker/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { Buffer } from 'node:buffer'
22
import type { DatabaseConnection, DatabaseIntrospector, Dialect, DialectAdapter, Driver, Kysely, QueryCompiler } from 'kysely'
33
import { SqliteAdapter, SqliteIntrospector, SqliteQueryCompiler } from 'kysely'
44
import type { Options } from 'better-sqlite3'
5-
import type { Promisable } from '../../dialect-wasm/src'
65
import { SqliteWorkerDriver } from './driver'
6+
import type { Promisable } from './type'
77

88
export type SqliteWorkerDialectConfig = {
99
/**

packages/dialect-sqlite-worker/src/type.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { QueryResult } from 'kysely'
22

3+
export type Promisable<T> = T | Promise<T>
4+
35
export type SqlData = {
46
sql: string
57
parameters?: readonly unknown[]

packages/dialect-sqlite-worker/src/worker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ if (!parentPort) {
99
const { src, option } = workerData
1010
const db = new Database(src, option)
1111

12-
parentPort.on('message', async (msg: MainMsg) => {
12+
parentPort.on('message', (msg: MainMsg) => {
1313
const ret: WorkerMsg = {
1414
type: msg.type,
1515
data: null,
1616
err: null,
1717
}
18-
const run = async () => {
18+
const run = () => {
1919
try {
2020
if (msg.type === 'close') {
2121
db.close()
@@ -45,6 +45,6 @@ parentPort.on('message', async (msg: MainMsg) => {
4545
ret.err = error
4646
}
4747
}
48-
await run()
48+
run()
4949
parentPort?.postMessage(ret)
5050
})

0 commit comments

Comments
 (0)