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,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);
}
} }
} }
}); });