Avoid sending multiple CHATHISTORY commands in parallel
This commit is contained in:
parent
897e0977e2
commit
a44ee8d170
1 changed files with 7 additions and 3 deletions
|
@ -439,9 +439,9 @@ export default class App extends Component {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var batch = this.client.batches.get(name);
|
var batch = this.client.batches.get(name);
|
||||||
if (batch.type == "chathistory" && batch.messages.length < CHATHISTORY_PAGE_SIZE) {
|
if (batch.type == "chathistory") {
|
||||||
var target = batch.params[0];
|
var target = batch.params[0];
|
||||||
this.endOfHistory.set(target, true);
|
this.endOfHistory.set(target, batch.messages.length < CHATHISTORY_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "CAP":
|
case "CAP":
|
||||||
|
@ -606,7 +606,7 @@ export default class App extends Component {
|
||||||
if (!this.client.enabledCaps["draft/chathistory"] || !this.client.enabledCaps["server-time"]) {
|
if (!this.client.enabledCaps["draft/chathistory"] || !this.client.enabledCaps["server-time"]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.endOfHistory.has(target)) {
|
if (this.endOfHistory.get(target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var buf = this.state.buffers.get(target);
|
var buf = this.state.buffers.get(target);
|
||||||
|
@ -622,6 +622,10 @@ export default class App extends Component {
|
||||||
command: "CHATHISTORY",
|
command: "CHATHISTORY",
|
||||||
params: ["BEFORE", target, "timestamp=" + before, CHATHISTORY_PAGE_SIZE],
|
params: ["BEFORE", target, "timestamp=" + before, CHATHISTORY_PAGE_SIZE],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Avoids sending multiple CHATHISTORY commands in parallel. The BATCH
|
||||||
|
// end handler will overwrite the value.
|
||||||
|
this.endOfHistory.set(target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue