Skip to content

Commit f629e41

Browse files
author
Germain Souquet
committed
Improve RR PoC
1 parent 4bf435d commit f629e41

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

src/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4614,6 +4614,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
46144614
* @return {module:http-api.MatrixError} Rejects: with an error response.
46154615
*/
46164616
public async sendReadReceipt(event: MatrixEvent, receiptType = ReceiptType.Read, callback?: Callback): Promise<{}> {
4617+
if (!event) return;
46174618
const eventId = event.getId();
46184619
const room = this.getRoom(event.getRoomId());
46194620
if (room && room.hasPendingEvent(eventId)) {

src/http-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ export class MatrixHttpApi {
390390
};
391391

392392
// set an initial timeout of 30s; we'll advance it each time we get a progress notification
393-
let timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);
393+
let timeoutTimer = callbacks.setTimeout(timeoutFn, 60000);
394394

395395
xhr.onreadystatechange = function() {
396396
let resp: string;
@@ -421,7 +421,7 @@ export class MatrixHttpApi {
421421
callbacks.clearTimeout(timeoutTimer);
422422
upload.loaded = ev.loaded;
423423
upload.total = ev.total;
424-
timeoutTimer = callbacks.setTimeout(timeoutFn, 30000);
424+
timeoutTimer = callbacks.setTimeout(timeoutFn, 60000);
425425
if (opts.progressHandler) {
426426
opts.progressHandler({
427427
loaded: ev.loaded,

src/models/room.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,9 +2460,10 @@ export class Room extends TimelineReceipts<EmittedEvents, RoomEventHandlerMap> {
24602460
Object.keys(content).forEach((eventId: string) => {
24612461
Object.keys(content[eventId]).forEach((receiptType: ReceiptType) => {
24622462
Object.keys(content[eventId][receiptType]).forEach((userId: string) => {
2463-
const receipt = content[eventId][receiptType][userId];
2463+
// hack, threadId should be thread_id
2464+
const receipt = content[eventId][receiptType][userId] as any;
24642465

2465-
const receiptDestination = this.threads.get(event.threadRootId) ?? this;
2466+
const receiptDestination = this.threads.get(receipt.threadId) ?? this;
24662467
receiptDestination.addReceiptToStructure(
24672468
eventId,
24682469
receiptType,

src/sliding-sync-sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export class SlidingSyncSdk {
250250
) {
251251
this.opts.initialSyncLimit = this.opts.initialSyncLimit ?? 8;
252252
this.opts.resolveInvitesToProfiles = this.opts.resolveInvitesToProfiles || false;
253-
this.opts.pollTimeout = this.opts.pollTimeout || (30 * 1000);
253+
this.opts.pollTimeout = this.opts.pollTimeout || (60 * 1000);
254254
this.opts.pendingEventOrdering = this.opts.pendingEventOrdering || PendingEventOrdering.Chronological;
255255
this.opts.experimentalThreadSupport = this.opts.experimentalThreadSupport === true;
256256

src/sync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export class SyncApi {
176176
constructor(private readonly client: MatrixClient, private readonly opts: Partial<IStoredClientOpts> = {}) {
177177
this.opts.initialSyncLimit = this.opts.initialSyncLimit ?? 8;
178178
this.opts.resolveInvitesToProfiles = this.opts.resolveInvitesToProfiles || false;
179-
this.opts.pollTimeout = this.opts.pollTimeout || (30 * 1000);
179+
this.opts.pollTimeout = this.opts.pollTimeout || (60 * 1000);
180180
this.opts.pendingEventOrdering = this.opts.pendingEventOrdering || PendingEventOrdering.Chronological;
181181
this.opts.experimentalThreadSupport = this.opts.experimentalThreadSupport === true;
182182

@@ -505,7 +505,7 @@ export class SyncApi {
505505
// FIXME: gut wrenching; hard-coded timeout values
506506
this.client.http.authedRequest<IEventsResponse>(undefined, Method.Get, "/events", {
507507
room_id: peekRoom.roomId,
508-
timeout: String(30 * 1000),
508+
timeout: String(60 * 1000),
509509
from: token,
510510
}, undefined, 50 * 1000).then((res) => {
511511
if (this._peekRoom !== peekRoom) {

0 commit comments

Comments
 (0)