Skip to content

Commit

Permalink
perf: ditch timeout adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
uetchy committed Mar 7, 2022
1 parent 9f68757 commit 64444a6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/masterchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ export class Masterchat extends EventEmitter {
// continuously fetch chat fragments
while (true) {
const res = await this.fetch(token);
const startMs = Date.now();

// handle chats
if (!(ignoreFirstResponse && !treatedFirstResponse)) {
Expand All @@ -307,11 +306,8 @@ export class Masterchat extends EventEmitter {
token = continuation.token;

if (this.isLive ?? true) {
const driftMs = Date.now() - startMs;
const timeoutMs = continuation.timeoutMs - driftMs;
if (timeoutMs > 500) {
await delay(timeoutMs, signal);
}
const timeoutMs = continuation.timeoutMs;
await delay(timeoutMs, signal);
}
}
}
Expand Down

0 comments on commit 64444a6

Please sign in to comment.