From fe1f4a50fdc15d510b6b04b42d54ada23512a058 Mon Sep 17 00:00:00 2001 From: Micah Nagel Date: Tue, 10 Dec 2024 14:11:20 -0700 Subject: [PATCH] chore: add retry around token set --- src/pepr/operator/controllers/keycloak/client-sync.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pepr/operator/controllers/keycloak/client-sync.ts b/src/pepr/operator/controllers/keycloak/client-sync.ts index f92dea26f..0a25eead6 100644 --- a/src/pepr/operator/controllers/keycloak/client-sync.ts +++ b/src/pepr/operator/controllers/keycloak/client-sync.ts @@ -8,7 +8,7 @@ import { fetch, K8s, kind } from "pepr"; import { Component, setupLogger } from "../../../logger"; import { Store } from "../../common"; import { Sso, UDSPackage } from "../../crd"; -import { getOwnerRef, purgeOrphans, sanitizeResourceName } from "../utils"; +import { getOwnerRef, purgeOrphans, retryWithDelay, sanitizeResourceName } from "../utils"; import { Client, clientKeys } from "./types"; let apiURL = @@ -173,7 +173,7 @@ async function syncClient( // Write the new token to the store try { - await Store.setItemAndWait(name, client.registrationAccessToken!); + await retryWithDelay(() => Store.setItemAndWait(name, client.registrationAccessToken!), log); } catch (err) { throw Error( `Failed to set token in store for client '${client.clientId}', package ` +