Use GetOperation to poll for OnboardUser completion (#15827)

Co-authored-by: Vedant Mahajan <vedant.04.mahajan@gmail.com>
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
Ishaan Gupta
2026-01-07 00:38:59 +05:30
committed by GitHub
parent 9172e28315
commit cce4574143
4 changed files with 133 additions and 9 deletions
+6 -4
View File
@@ -89,11 +89,13 @@ export async function setupUser(client: AuthClient): Promise<UserData> {
};
}
// Poll onboardUser until long running operation is complete.
let lroRes = await caServer.onboardUser(onboardReq);
while (!lroRes.done) {
await new Promise((f) => setTimeout(f, 5000));
lroRes = await caServer.onboardUser(onboardReq);
if (!lroRes.done && lroRes.name) {
const operationName = lroRes.name;
while (!lroRes.done) {
await new Promise((f) => setTimeout(f, 5000));
lroRes = await caServer.getOperation(operationName);
}
}
if (!lroRes.response?.cloudaicompanionProject?.id) {