From 9e93c3db57c1ca373da5e6c152a3a6a2e99c68cd Mon Sep 17 00:00:00 2001 From: Mike Johnston Date: Fri, 27 Mar 2026 22:01:53 -0400 Subject: [PATCH] Update time references to Eastern Time and adjust maintenance job schedule --- README.md | 4 ++-- prod-compose.yml | 2 ++ src/app/api/lottery/pick/route.ts | 8 ++++---- src/worker/index.ts | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d34a650..b0e19cc 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ At low activity the curve is approximately linear (≈ $0.25 per post/hr). At hi ## Research System -- Every player earns **1 research point per day** (awarded at 00:05 UTC by the maintenance worker). +- Every player earns **1 research point per day** (awarded at midnight EST by the maintenance worker). - Balance milestones unlock extra daily points: | Balance | Daily points | @@ -222,7 +222,7 @@ Three BullMQ queues: |---|---| | `hashex-price-updates` | One job per active hashtag; fetches Mastodon and updates price + price history. Concurrency = 1 to respect rate limits. | | `hashex-scheduler` | Fires every `PRICE_UPDATE_INTERVAL_MINUTES`. Enqueues price-update jobs ordered by `lastUpdated ASC` (most stale first). Deduplicates by `jobId` to avoid pile-up. | -| `hashex-maintenance` | Runs daily at 00:05 UTC. Awards research points based on each player's balance. | +| `hashex-maintenance` | Runs daily at midnight EST. Awards research points based on each player's balance. | The worker retries failed jobs up to 3 times with exponential back-off (5 s base delay). diff --git a/prod-compose.yml b/prod-compose.yml index 6444cd5..d89af31 100644 --- a/prod-compose.yml +++ b/prod-compose.yml @@ -20,6 +20,7 @@ services: MAX_POSITION_VALUE: "${MAX_POSITION_VALUE:-1000}" FUND_MAX_POSITION_SHARES: "${FUND_MAX_POSITION_SHARES:-1000}" FUND_MAX_POSITION_VALUE: "${FUND_MAX_POSITION_VALUE:-10000}" + TZ: "America/Toronto" depends_on: postgres: condition: service_healthy @@ -43,6 +44,7 @@ services: MASTODON_POST_LIMIT: "${MASTODON_POST_LIMIT:-20}" PRICE_HISTORY_ACTIVE_DAYS: "${PRICE_HISTORY_ACTIVE_DAYS:-7}" PRICE_HISTORY_INACTIVE_HOURS: "${PRICE_HISTORY_INACTIVE_HOURS:-24}" + TZ: "America/Toronto" depends_on: postgres: condition: service_healthy diff --git a/src/app/api/lottery/pick/route.ts b/src/app/api/lottery/pick/route.ts index 84e081e..a18f986 100644 --- a/src/app/api/lottery/pick/route.ts +++ b/src/app/api/lottery/pick/route.ts @@ -16,9 +16,9 @@ function buildPrizes(): number[] { function isSameDay(a: Date, b: Date) { return ( - a.getUTCFullYear() === b.getUTCFullYear() && - a.getUTCMonth() === b.getUTCMonth() && - a.getUTCDate() === b.getUTCDate() + a.getFullYear() === b.getFullYear() && + a.getMonth() === b.getMonth() && + a.getDate() === b.getDate() ) } @@ -26,7 +26,7 @@ function isSameDay(a: Date, b: Date) { * POST /api/lottery/pick * Body: { box: number } (0-indexed, 0–24) * - * One free play per calendar day (UTC). Reveals prize at the chosen box. + * One free play per calendar day (Eastern Time). Reveals prize at the chosen box. */ export async function POST(req: NextRequest) { const session = await getServerSession(authOptions) diff --git a/src/worker/index.ts b/src/worker/index.ts index 5c90dfb..c4275a3 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -502,12 +502,12 @@ async function setupRepeatableJobs() { }, ) - // Daily maintenance — every day at 05:00 UTC + // Daily maintenance — every day at 00:00 Eastern (midnight) await maintenanceQueue.add( 'daily-maintenance', {}, { - repeat: { pattern: '0 5 * * *' }, + repeat: { pattern: '0 0 * * *' }, }, )