Skip to content

Commit b95e6e1

Browse files
committed
feat(server): added cache update on app start
1 parent af6dfda commit b95e6e1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/src/app.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import { MongooseDatabaseConnection } from '@/infrastructure/database/connection';
2020
import logger from '@/infrastructure/logger/logger';
2121
import { Master } from '@/infrastructure/worker/master';
22+
import { CacheService } from '@/services/cache/cache-service';
2223
import { runCron } from '@/services/cron';
2324
import { MigrationService } from '@/services/migration/migration';
2425
import { SettingsService } from '@/services/settings/settings';
@@ -70,7 +71,14 @@ async function doPrimary() {
7071
}
7172

7273
// Load settings into cache
73-
await getFromContainer(SettingsService).getSettings();
74+
const settingsService = getFromContainer(SettingsService);
75+
await settingsService.getSettings();
76+
77+
// Create initial cache if it doesn't exist
78+
logger.info('Updating cache with common resources');
79+
const cacheService = getFromContainer(CacheService);
80+
await cacheService.getCommonResources();
81+
logger.info('Cache finished updating');
7482

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

0 commit comments

Comments
 (0)