Skip to content

Commit 7cccaf4

Browse files
authored
[server] SpiceDB: try up to 3 times not only for INTERNAL, but also DEADLINE_EXCEEDED (#19803)
1 parent c1cfd85 commit 7cccaf4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

components/server/src/authorization/spicedb-authorizer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messag
1919

2020
async function tryThree<T>(errMessage: string, code: (attempt: number) => Promise<T>): Promise<T> {
2121
let attempt = 0;
22-
// we do sometimes see INTERNAL errors from SpiceDB, so we retry a few times
22+
// we do sometimes see INTERNAL errors from SpiceDB, or grpc-js reports DEADLINE_EXCEEDED, so we retry a few times
2323
// last time we checked it was 15 times per day (check logs)
2424
while (attempt++ < 3) {
2525
try {
2626
return await code(attempt);
2727
} catch (err) {
28-
if (err.code === grpc.status.INTERNAL && attempt < 3) {
28+
if ((err.code === grpc.status.INTERNAL || err.code === grpc.status.DEADLINE_EXCEEDED) && attempt < 3) {
2929
log.warn(errMessage, err, {
3030
attempt,
31+
code: err.code,
3132
});
3233
} else {
3334
log.error(errMessage, err, {
3435
attempt,
36+
code: err.code,
3537
});
3638
// we don't try again on other errors
3739
throw err;

0 commit comments

Comments
 (0)