remove pending events that failed because of permanent error

so they don't get stuck
This commit is contained in:
Bruno Windels 2021-05-20 14:52:30 +02:00
parent 4ce66fc8a1
commit 9721432a8c

View file

@ -63,9 +63,19 @@ export class SendQueue {
pendingEvent.setWaiting();
} else {
log.catch(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);
}
}
}
});
}
} finally {