mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Increase replication timeout to 2s
This commit is contained in:
parent
0df594abe7
commit
5edccc322c
@ -333,16 +333,16 @@ function extendWithReplicationWait<T extends PrismaClient>(primary: T, replicaCl
|
||||
}
|
||||
span.setAttribute('stack.db-replication.target', target);
|
||||
|
||||
// Wait for replication with a 1 second timeout to prevent hanging
|
||||
const caughtUp = await waitForReplication(replicaClients, target, 1000);
|
||||
// Wait for replication with a 2s timeout to prevent hanging
|
||||
const caughtUp = await waitForReplication(replicaClients, target, 2000);
|
||||
if (!caughtUp) {
|
||||
span.setAttribute('stack.db-replication.timeout', true);
|
||||
captureError("prisma-client-replication-timeout", new StackAssertionError("Replication wait timed out after 1 second. The replica may be behind, or something weird is going on!"));
|
||||
captureError("prisma-client-replication-timeout", new StackAssertionError("Replication wait timed out after 2s. The replica may be behind, or something weird is going on!"));
|
||||
}
|
||||
} catch (e) {
|
||||
span.setAttribute('stack.db-replication.error', `${e}`);
|
||||
captureError("prisma-client-replication-error", new StackAssertionError("Error getting replication target and waiting. We'll just wait 50ms instead, but please fix this as the replication may not be working.", { cause: e }));
|
||||
await wait(50);
|
||||
captureError("prisma-client-replication-error", new StackAssertionError("Error getting replication target and waiting. We'll just wait 1000ms instead, but please fix this as the replication may not be working.", { cause: e }));
|
||||
await wait(1_000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user