From a25c88bf131b338387c28e2b1650da7ef99db71d Mon Sep 17 00:00:00 2001 From: SomeRandomDeveloper Date: Tue, 14 Apr 2026 00:36:00 +0200 Subject: [PATCH] Disconnect from DB while generating aggregation --- src/aggregateDaily.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/aggregateDaily.ts b/src/aggregateDaily.ts index e21ac5f..37f6012 100644 --- a/src/aggregateDaily.ts +++ b/src/aggregateDaily.ts @@ -25,10 +25,17 @@ if (!aggregatedProfiles || aggregatedProfiles.length === 0) { process.exit(0); } +// Disconnect so we don't block the DB during the aggregation +await prisma.$disconnect(); + const aggregatedData = aggregateSpeedscopeData( aggregatedProfiles, `Daily aggregation (${start.toISOString()} to ${end.toISOString()})` ); + +// Connect to the DB again +await prisma.$connect(); + await prisma.aggregatedProfile.create({ data: { startTime: start,