Use buffer IDs in endOfHistory

This commit is contained in:
Simon Ser 2021-01-22 15:49:22 +01:00
parent 06eb639ee9
commit 95daea0ef7

View File

@ -954,7 +954,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.get(buf.name)) { if (this.endOfHistory.get(buf.id)) {
return; return;
} }
@ -966,11 +966,11 @@ export default class App extends Component {
} }
// Avoids sending multiple CHATHISTORY commands in parallel // Avoids sending multiple CHATHISTORY commands in parallel
this.endOfHistory.set(buf.name, true); this.endOfHistory.set(buf.id, true);
var params = ["BEFORE", buf.name, "timestamp=" + before, CHATHISTORY_PAGE_SIZE]; var params = ["BEFORE", buf.name, "timestamp=" + before, CHATHISTORY_PAGE_SIZE];
this.roundtripChatHistory(params).then((batch) => { this.roundtripChatHistory(params).then((batch) => {
this.endOfHistory.set(buf.name, batch.messages.length < CHATHISTORY_PAGE_SIZE); this.endOfHistory.set(buf.id, batch.messages.length < CHATHISTORY_PAGE_SIZE);
}); });
} }