Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions ts/fast-sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,13 @@ export class FastSyncReceiver {
})
for await (const objectBatch of this.options.channel.streamObjectBatches()) {
// console.log('recv: start iter')
for (const object of objectBatch.objects) {
await this.options.storageManager
.collection(objectBatch.collection)
.createObject(object)
}
await this.options.storageManager.collection(objectBatch.collection).rawCreateObjects(objectBatch.objects, {withNestedObjects: false})
this.totalObjectsProcessed += objectBatch.objects.length
this.events.emit('progress', {
progress: {
...syncInfo,
totalObjectsProcessed: this.totalObjectsProcessed,
},
}
})
// console.log('recv: end iter')
}
Expand Down
10 changes: 10 additions & 0 deletions ts/logging-middleware/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ describe('Sync logging middleware', () => {
])
})

it('should not write rawCreateObjects operations to the ClientSyncLog', async () => {
const { storageManager, clientSyncLog } = await setupTest({now: () => 3})
await storageManager.collection('user').rawCreateObjects([
{id: 53, displayName: 'John Doe'},
{id: 54, displayName: 'Jane Doe'},
],{withNestedObjects: false})
expect(await clientSyncLog.getEntriesCreatedAfter(1)).toEqual([
])
})

it('should write updateObject operations done by pk on a single field to the ClientSyncLog in a batch write', async () => {
let now = 2
const { storageManager, clientSyncLog } = await setupTest({
Expand Down