fix: large transaction (#6695)
This commit is contained in:
@@ -593,9 +593,8 @@ export const prompts: Prompt[] = [
|
||||
];
|
||||
|
||||
export async function refreshPrompts(db: PrismaClient) {
|
||||
await db.$transaction(async tx => {
|
||||
for (const prompt of prompts) {
|
||||
await tx.aiPrompt.upsert({
|
||||
await db.aiPrompt.upsert({
|
||||
create: {
|
||||
name: prompt.name,
|
||||
action: prompt.action,
|
||||
@@ -625,5 +624,4 @@ export async function refreshPrompts(db: PrismaClient) {
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ export async function upgradeQuotaVersion(
|
||||
// add new quota
|
||||
await upsertFeature(db, quota);
|
||||
// migrate all users that using old quota to new quota
|
||||
await db.$transaction(async tx => {
|
||||
await db.$transaction(
|
||||
async tx => {
|
||||
const latestQuotaVersion = await tx.features.findFirstOrThrow({
|
||||
where: { feature: quota.feature },
|
||||
orderBy: { version: 'desc' },
|
||||
@@ -62,7 +63,12 @@ export async function upgradeQuotaVersion(
|
||||
activated: true,
|
||||
})),
|
||||
});
|
||||
});
|
||||
},
|
||||
{
|
||||
maxWait: 10000,
|
||||
timeout: 20000,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export async function upsertLatestQuotaVersion(
|
||||
|
||||
Reference in New Issue
Block a user