add research points to new hedge funds and update maintenance job schedule
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m22s

This commit is contained in:
2026-03-22 00:31:52 -04:00
parent 3ce7bd36b8
commit 72885ed0b0
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -61,6 +61,7 @@ export async function POST(req: NextRequest) {
displayUsername: name, displayUsername: name,
passwordHash: await bcrypt.hash(crypto.randomUUID(), 10), // random, non-loginable passwordHash: await bcrypt.hash(crypto.randomUUID(), 10), // random, non-loginable
balance: initialBalance, balance: initialBalance,
researchPoints: 0,
isFund: true, isFund: true,
}, },
}) })
+4 -4
View File
@@ -247,7 +247,7 @@ const maintenanceWorker = new Worker(
console.log(`[maintenance] running daily maintenance (job ${job.id})`) console.log(`[maintenance] running daily maintenance (job ${job.id})`)
const MAX_RESEARCH_POINTS = 10 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) { for (const user of users) {
const points = dailyResearchPoints(user.balance) const points = dailyResearchPoints(user.balance)
const newTotal = Math.min(user.researchPoints + points, MAX_RESEARCH_POINTS) 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( await maintenanceQueue.add(
'daily-maintenance', '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( await fundNavSnapshotQueue.add(
'fund-nav-snapshot', 'fund-nav-snapshot',
{}, {},