feat: optimización integral y auditoría de rendimiento SIBU 2.0.1
This commit is contained in:
@ -22,6 +22,9 @@ export const useRouteStore = defineStore('route', () => {
|
||||
const CACHE_TIME = 1000 * 60 * 15; // 15 minutos
|
||||
const now = Date.now();
|
||||
|
||||
// Guard: Si ya se están cargando rutas, no iniciar otra petición
|
||||
if (isLoadingRoutes.value) return;
|
||||
|
||||
// Si no forzamos, no hay filtros raros, ya tenemos rutas y aún no expira el caché, omitir llamada
|
||||
if (!force && !filters && allRoutes.value.length > 0 && (now - lastFetched.value < CACHE_TIME)) {
|
||||
return
|
||||
@ -44,6 +47,7 @@ export const useRouteStore = defineStore('route', () => {
|
||||
const CACHE_TIME = 1000 * 60 * 15; // 15 minutos
|
||||
const now = Date.now();
|
||||
|
||||
if (isLoadingStops.value) return;
|
||||
if (!force && stopsCache.value.has(routeId)) {
|
||||
const cacheEntry = stopsCache.value.get(routeId)!;
|
||||
if (now - cacheEntry.fetchedAt < CACHE_TIME) {
|
||||
|
||||
Reference in New Issue
Block a user