Hot reload proactif post-cron pour ratings + mappings + chunks (evite la latence du 1er appel)
This commit is contained in:
@@ -5,6 +5,7 @@ import secureSession from '@fastify/secure-session';
|
||||
import fastifyStatic from '@fastify/static';
|
||||
import Fastify from 'fastify';
|
||||
import { HOST, PORT, RATE_LIMIT_PER_SEC, ROOT, SESSION_SECRET } from './config.js';
|
||||
import { startWatchers } from './lib/dataReload.js';
|
||||
import { preloadMappings } from './lib/imdbMapping.js';
|
||||
import { getRatings } from './lib/imdbRatings.js';
|
||||
import { httpDuration, httpRequests, imdbRatingsCount, searchWorkers } from './lib/metrics.js';
|
||||
@@ -82,9 +83,10 @@ fastify.ready().then(async () => {
|
||||
searchWorkers.set({ type: 'movie' }, movie.workers.length);
|
||||
searchWorkers.set({ type: 'tv' }, tv.workers.length);
|
||||
const maps = await preloadMappings();
|
||||
startWatchers();
|
||||
fastify.log.info(
|
||||
{ ratings: ratings.size, imdb_movie: maps.movie, imdb_tv: maps.tv },
|
||||
'Warmup complete',
|
||||
'Warmup complete (data hot-reload watchers started)',
|
||||
);
|
||||
} catch (err) {
|
||||
fastify.log.warn({ err }, 'Warmup failed');
|
||||
|
||||
Reference in New Issue
Block a user