Skip to content

Commit

Permalink
fix: dont run scheduler if not in production
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Julien-R44 committed May 18, 2024
1 parent 5740020 commit 1453159
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions start/scheduler.ts
Original file line number Diff line number Diff line change
@@ -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'

/**
Expand All @@ -12,5 +11,5 @@ CronJob.from({
start: true,
cronTime: '0 */3 * * *',
onTick: () => refresher.refresh(),
runOnInit: !!env.get('GITHUB_TOKEN') || app.inProduction,
runOnInit: app.inProduction,
})

0 comments on commit 1453159

Please sign in to comment.