From 756b40ce2ccc62054f804c973f7d6c5ae19f7b8a Mon Sep 17 00:00:00 2001 From: Dominik Piatek Date: Fri, 8 Sep 2023 11:21:08 +0100 Subject: [PATCH] Update default batch time to 25ms --- docs/class-definitions.md | 2 +- src/Cursors.test.ts | 4 ++-- src/Space.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/class-definitions.md b/docs/class-definitions.md index dbc12d0c..dc9069ff 100644 --- a/docs/class-definitions.md +++ b/docs/class-definitions.md @@ -86,7 +86,7 @@ type CursorsOptions = { ##### outboundBatchInterval -The interval in milliseconds at which a batch of cursor positions are published. This is multiplied by the number of members in the space minus 1. The default value is 100ms. +The interval in milliseconds at which a batch of cursor positions are published. This is multiplied by the number of members in the space minus 1. The default value is 25ms. ##### paginationLimit diff --git a/src/Cursors.test.ts b/src/Cursors.test.ts index e1e9c3fe..3f1daa60 100644 --- a/src/Cursors.test.ts +++ b/src/Cursors.test.ts @@ -116,7 +116,7 @@ describe('Cursors', () => { vi.spyOn(channel.presence, 'get').mockImplementation(createPresenceCount(2)); await cursors['onPresenceUpdate'](); expect(batching.shouldSend).toBeTruthy(); - expect(batching.batchTime).toEqual(200); + expect(batching.batchTime).toEqual(50); }); it('batchTime is updated when multiple people are present', async ({ @@ -126,7 +126,7 @@ describe('Cursors', () => { }) => { vi.spyOn(channel.presence, 'get').mockImplementation(createPresenceCount(2)); await cursors['onPresenceUpdate'](); - expect(batching.batchTime).toEqual(200); + expect(batching.batchTime).toEqual(50); }); describe('pushCursorPosition', () => { diff --git a/src/Space.ts b/src/Space.ts index 5ec98a55..ccf314f9 100644 --- a/src/Space.ts +++ b/src/Space.ts @@ -25,7 +25,7 @@ const SPACE_CHANNEL_TAG = '-space'; const SPACE_OPTIONS_DEFAULTS = { offlineTimeout: 120_000, cursors: { - outboundBatchInterval: 100, + outboundBatchInterval: 25, paginationLimit: 5, }, };