From 72885ed0b0f5364db0fa6756f6d6731148db2bd3 Mon Sep 17 00:00:00 2001 From: Mike Johnston Date: Sun, 22 Mar 2026 00:31:52 -0400 Subject: [PATCH] add research points to new hedge funds and update maintenance job schedule --- src/app/api/admin/funds/route.ts | 1 + src/worker/index.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/api/admin/funds/route.ts b/src/app/api/admin/funds/route.ts index 8d2fb39..ecbc5c3 100644 --- a/src/app/api/admin/funds/route.ts +++ b/src/app/api/admin/funds/route.ts @@ -61,6 +61,7 @@ export async function POST(req: NextRequest) { displayUsername: name, passwordHash: await bcrypt.hash(crypto.randomUUID(), 10), // random, non-loginable balance: initialBalance, + researchPoints: 0, isFund: true, }, }) diff --git a/src/worker/index.ts b/src/worker/index.ts index af1ba1f..a088d7f 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -247,7 +247,7 @@ const maintenanceWorker = new Worker( console.log(`[maintenance] running daily maintenance (job ${job.id})`) const MAX_RESEARCH_POINTS = 10 - const users = await prisma.user.findMany({ select: { id: true, balance: true, researchPoints: true } }) + const users = await prisma.user.findMany({ where: { isFund: false }, select: { id: true, balance: true, researchPoints: true } }) for (const user of users) { const points = dailyResearchPoints(user.balance) const newTotal = Math.min(user.researchPoints + points, MAX_RESEARCH_POINTS) @@ -485,16 +485,16 @@ async function setupRepeatableJobs() { }, ) - // Daily maintenance — every day at 00:05 UTC + // Daily maintenance — every day at 05:00 UTC await maintenanceQueue.add( 'daily-maintenance', {}, { - repeat: { pattern: '5 0 * * *' }, + repeat: { pattern: '0 5 * * *' }, }, ) - // Hourly fund NAV snapshot — every hour on the hour + // Hourly fund NAV snapshot — every 15 minutes await fundNavSnapshotQueue.add( 'fund-nav-snapshot', {},