Precharge les mappings IMDb au warmup (1.27s -> 16ms sur le premier appel /api?t=imdb)
This commit is contained in:
@@ -33,3 +33,12 @@ export async function lookupImdb(imdbId) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Eager-load both mappings — used at server startup to remove the first-request
|
||||
// 1s latency. Returns the number of entries loaded per type.
|
||||
export async function preloadMappings() {
|
||||
const out = { movie: 0, tv: 0 };
|
||||
try { out.movie = (await loadOne('movie')).size; } catch { /* missing */ }
|
||||
try { out.tv = (await loadOne('tv')).size; } catch { /* missing */ }
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user