Skip to content

Commit a03945a

Browse files
committed
More logs
1 parent 447fcb8 commit a03945a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

demos/example-node/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ Once you have these ready:
1616
2. Then run the following, inserting your instance URL and developer token:
1717
```DEMO_ENDPOINT=https://yourinstance.powersync.journeyapps.com DEMO_TOKEN=YOURTOKEN pnpm run start
1818
```
19-
This opens the local database, connects to PowerSync, waits for a first sync and then runs a simple query.
19+
This opens the local database, connects to PowerSync, waits for a first sync and then runs a simple query.

demos/example-node/src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
PowerSyncBackendConnector,
55
PowerSyncDatabase,
66
Schema,
7+
SyncStreamConnectionMethod,
78
Table
89
} from '@powersync/node';
910
import Logger from 'js-logger';
@@ -28,8 +29,9 @@ const main = async () => {
2829
}
2930
});
3031

31-
await db.connect(new DemoConnector());
32+
await db.connect(new DemoConnector(), {connectionMethod: SyncStreamConnectionMethod.HTTP});
3233
await db.waitForFirstSync();
34+
console.log('First sync complete!');
3335

3436
let hasFirstRow: ((value: any) => void) | null = null;
3537
const firstRow = new Promise((resolve) => (hasFirstRow = resolve));
@@ -51,6 +53,8 @@ const main = async () => {
5153

5254
class DemoConnector implements PowerSyncBackendConnector {
5355
async fetchCredentials() {
56+
console.log('fetchCredentials called');
57+
5458
return {
5559
endpoint: process.env.DEMO_ENDPOINT!,
5660
token: process.env.DEMO_TOKEN!,

packages/node/src/db/BetterSQLite3DBAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class BetterSQLite3DBAdapter extends BaseObserver<DBAdapterListener> impl
5353
}
5454

5555
const openWorker = async (isWriter: boolean) => {
56-
const worker = new Worker(new URL('./SqliteWorker.js', import.meta.url));
56+
const worker = new Worker(new URL('./SqliteWorker.js', import.meta.url), {name: isWriter ? `write ${dbFilePath}` : `read ${dbFilePath}`});
5757
const listeners = new WeakMap<EventListenerOrEventListenerObject, (e: any) => void>();
5858

5959
const comlink = Comlink.wrap<AsyncDatabaseOpener>({

0 commit comments

Comments
 (0)