Skip to content

Commit

Permalink
feat(server): added cache update on app start
Browse files Browse the repository at this point in the history
  • Loading branch information
ADRFranklin committed Jun 8, 2024
1 parent af6dfda commit b95e6e1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { MongooseDatabaseConnection } from '@/infrastructure/database/connection';
import logger from '@/infrastructure/logger/logger';
import { Master } from '@/infrastructure/worker/master';
import { CacheService } from '@/services/cache/cache-service';
import { runCron } from '@/services/cron';
import { MigrationService } from '@/services/migration/migration';
import { SettingsService } from '@/services/settings/settings';
Expand Down Expand Up @@ -70,7 +71,14 @@ async function doPrimary() {
}

// Load settings into cache
await getFromContainer(SettingsService).getSettings();
const settingsService = getFromContainer(SettingsService);
await settingsService.getSettings();

// Create initial cache if it doesn't exist
logger.info('Updating cache with common resources');
const cacheService = getFromContainer(CacheService);
await cacheService.getCommonResources();
logger.info('Cache finished updating');

logger.info(`Petio v${appConfig.version} [debug] [pid:${PUID},gid:${PGID}]`);

Expand Down

0 comments on commit b95e6e1

Please sign in to comment.