mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Increase workflow compilation timeout
This commit is contained in:
parent
3991b1051b
commit
83d4ab27ca
@ -165,9 +165,10 @@ async function compileWorkflow(tenancy: Tenancy, workflowId: string): Promise<Re
|
||||
compiledCode: compiledCodeResult.data,
|
||||
registeredTriggers: registeredTriggers,
|
||||
});
|
||||
}, 10_000);
|
||||
}, 30_000);
|
||||
|
||||
if (res.status === "error") {
|
||||
console.warn(`Timed out compiling workflow ${workflowId} after ${res.error.ms}ms`, { res });
|
||||
return Result.error({ compileError: `Timed out compiling workflow ${workflowId} after ${res.error.ms}ms` });
|
||||
}
|
||||
return res.data;
|
||||
@ -354,11 +355,11 @@ async function compileAndGetEnabledWorkflows(tenancy: Tenancy): Promise<Map<stri
|
||||
const { count } = await prisma.currentlyCompilingWorkflow.deleteMany({
|
||||
where: {
|
||||
tenancyId: tenancy.id,
|
||||
startedCompilingAt: { lt: new Date(Date.now() - 20_000) },
|
||||
startedCompilingAt: { lt: new Date(Date.now() - 40_000) },
|
||||
},
|
||||
});
|
||||
if (count > 0) {
|
||||
captureError("workflows-compile-timeout", new StackAssertionError(`Deleted ${count} currently compiling workflows that were compiling for more than 20 seconds; this probably indicates a bug in the workflow compilation code`));
|
||||
captureError("workflows-compile-timeout", new StackAssertionError(`Deleted ${count} currently compiling workflows that were compiling for more than 40 seconds; this probably indicates a bug in the workflow compilation code (as they should time out after 30 seconds)`));
|
||||
}
|
||||
|
||||
await wait(1000);
|
||||
|
||||
@ -203,6 +203,18 @@ export namespace Auth {
|
||||
}
|
||||
}
|
||||
|
||||
export async function refreshAccessToken() {
|
||||
const response = await niceBackendFetch("/api/v1/auth/sessions/current/refresh", { method: "POST", accessType: "client" });
|
||||
if (response.status !== 200) {
|
||||
throw new StackAssertionError("Expected session to be valid, but was actually invalid.", { response });
|
||||
}
|
||||
backendContext.set({ userAuth: { accessToken: response.body.access_token, refreshToken: response.body.refresh_token } });
|
||||
await ensureParsableAccessToken();
|
||||
return {
|
||||
refreshAccessTokenResponse: response,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid session & valid access token: OK
|
||||
* Valid session & invalid access token: OK
|
||||
|
||||
@ -216,6 +216,7 @@ test("disabled workflows do not trigger", async ({ expect }) => {
|
||||
await Auth.Password.signUpWithEmail({ password: "password" });
|
||||
|
||||
await wait(waitRetries * 1_000 * 1.3);
|
||||
await Auth.refreshAccessToken();
|
||||
|
||||
expect(await mailbox.fetchMessages()).toMatchInlineSnapshot(`
|
||||
[
|
||||
@ -304,6 +305,7 @@ test("anonymous sign-up does not trigger; upgrade triggers workflow", async ({ e
|
||||
|
||||
// ensure marker not present yet
|
||||
await wait(waitRetries * 1_000 * 1.3);
|
||||
await Auth.refreshAccessToken();
|
||||
const me1 = await niceBackendFetch("/api/v1/users/me", { accessType: "client" });
|
||||
expect(me1.body.server_metadata?.[markerKey]).toBeUndefined();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user