From 14531596197f4879a5dda0fc955a64d471195247 Mon Sep 17 00:00:00 2001 From: Julien Ripouteau Date: Sat, 18 May 2024 09:54:50 +0200 Subject: [PATCH] fix: dont run scheduler if not in production Otherwise, the scheduler will run every time the server is restarted, and so the boot time will explode. In development, we should instead use seeders. The PackageStatSeeder seeder is responsible for fetching all this. --- start/scheduler.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/start/scheduler.ts b/start/scheduler.ts index be06d86..82ab9da 100644 --- a/start/scheduler.ts +++ b/start/scheduler.ts @@ -1,7 +1,6 @@ import { CronJob } from 'cron' import app from '@adonisjs/core/services/app' -import env from '#start/env' import { PackagesDataRefresher } from '#services/packages_data_refresher' /** @@ -12,5 +11,5 @@ CronJob.from({ start: true, cronTime: '0 */3 * * *', onTick: () => refresher.refresh(), - runOnInit: !!env.get('GITHUB_TOKEN') || app.inProduction, + runOnInit: app.inProduction, })