forked from mystiq/hydrogen-web
remove pending events that failed because of permanent error
so they don't get stuck
This commit is contained in:
parent
4ce66fc8a1
commit
9721432a8c
1 changed files with 11 additions and 1 deletions
|
@ -63,7 +63,17 @@ export class SendQueue {
|
||||||
pendingEvent.setWaiting();
|
pendingEvent.setWaiting();
|
||||||
} else {
|
} else {
|
||||||
log.catch(err);
|
log.catch(err);
|
||||||
pendingEvent.setError(err);
|
const isPermanentError = err.name === "HomeServerError" && (
|
||||||
|
err.statusCode === 400 || // bad request, must be a bug on our end
|
||||||
|
err.statusCode === 403 || // forbidden
|
||||||
|
err.statusCode === 404 // not found
|
||||||
|
);
|
||||||
|
if (isPermanentError) {
|
||||||
|
log.set("remove", true);
|
||||||
|
await pendingEvent.abort();
|
||||||
|
} else {
|
||||||
|
pendingEvent.setError(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue