mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-14 19:05:01 -05:00
Don't stop fetching backlog on error
Some servers allow fetching history from some targets but not others. Don't completely stop fetching chat history on error. The root cause was a variable shadowing in Client.fetchBatch.
This commit is contained in:
parent
1206cfae37
commit
195e4ca371
2 changed files with 5 additions and 3 deletions
|
@ -1012,8 +1012,9 @@ export default class App extends Component {
|
||||||
|
|
||||||
fetchBacklog(client, target, after, before) {
|
fetchBacklog(client, target, after, before) {
|
||||||
client.fetchHistoryBetween(target, after, before, CHATHISTORY_MAX_SIZE).catch((err) => {
|
client.fetchHistoryBetween(target, after, before, CHATHISTORY_MAX_SIZE).catch((err) => {
|
||||||
this.setState({ error: "Failed to fetch history for '" + target + "': " + err });
|
console.error("Failed to fetch backlog for '" + target + "': ", err);
|
||||||
this.receipts.delete(channel);
|
this.setState({ error: "Failed to fetch backlog for '" + target + "'" });
|
||||||
|
this.receipts.delete(target);
|
||||||
this.saveReceipts();
|
this.saveReceipts();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -704,6 +704,7 @@ export default class Client extends EventTarget {
|
||||||
fetchBatch(msg, batchType) {
|
fetchBatch(msg, batchType) {
|
||||||
let batchName = null;
|
let batchName = null;
|
||||||
let messages = [];
|
let messages = [];
|
||||||
|
let cmd = msg.command;
|
||||||
return this.roundtrip(msg, (msg) => {
|
return this.roundtrip(msg, (msg) => {
|
||||||
if (batchName) {
|
if (batchName) {
|
||||||
let batch = msg.batch;
|
let batch = msg.batch;
|
||||||
|
@ -729,7 +730,7 @@ export default class Client extends EventTarget {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "FAIL":
|
case "FAIL":
|
||||||
if (msg.params[0] === msg.command) {
|
if (msg.params[0] === cmd) {
|
||||||
throw msg;
|
throw msg;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue