mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-31 07:00:26 +00:00
Mitigation for gappy/limited sync responses in SPA mode
This commit is contained in:
@@ -9,8 +9,10 @@ import { IndexedDBStore } from "matrix-js-sdk/src/store/indexeddb";
|
||||
import { MemoryStore } from "matrix-js-sdk/src/store/memory";
|
||||
import {
|
||||
createClient,
|
||||
Filter,
|
||||
ICreateClientOpts,
|
||||
Preset,
|
||||
RoomEvent,
|
||||
Visibility,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { ClientEvent } from "matrix-js-sdk/src/client";
|
||||
@@ -165,7 +167,20 @@ export async function initClient(
|
||||
// Otherwise, a sync may complete before the listener gets applied,
|
||||
// and we will miss it.
|
||||
const syncPromise = waitForSync(client);
|
||||
await client.startClient({ clientWellKnownPollPeriod: 60 * 10 });
|
||||
await client.startClient({
|
||||
clientWellKnownPollPeriod: 60 * 10,
|
||||
// ask for a high limit to try and avoid gappy syncs
|
||||
filter: Filter.fromJson(undefined, "element-call", {
|
||||
room: {
|
||||
timeline: {
|
||||
limit: 1000,
|
||||
},
|
||||
},
|
||||
}),
|
||||
// we ask for 20 past message to try and get some recent context
|
||||
// n.b. past reactions are not guaranteed to be visible
|
||||
initialSyncLimit: 20,
|
||||
});
|
||||
await syncPromise;
|
||||
|
||||
return client;
|
||||
|
||||
Reference in New Issue
Block a user