preload caches
parent
644dac9aba
commit
059917f43d
2
app.js
2
app.js
|
|
@ -19,6 +19,7 @@ import routerLotOccupancies from './routes/lotOccupancies.js';
|
|||
import routerWorkOrders from './routes/workOrders.js';
|
||||
import routerReports from './routes/reports.js';
|
||||
import routerAdmin from './routes/admin.js';
|
||||
import { preloadCaches } from './helpers/functions.cache.js';
|
||||
import * as configFunctions from './helpers/functions.config.js';
|
||||
import * as printFunctions from './helpers/functions.print.js';
|
||||
import * as dateTimeFns from '@cityssm/utils-datetime';
|
||||
|
|
@ -32,6 +33,7 @@ import { useTestDatabases } from './data/databasePaths.js';
|
|||
import Debug from 'debug';
|
||||
const debug = Debug(`lot-occupancy-system:app:${process.pid}`);
|
||||
databaseInitializer.initializeDatabase();
|
||||
await preloadCaches();
|
||||
const _dirname = '.';
|
||||
export const app = express();
|
||||
app.disable('X-Powered-By');
|
||||
|
|
|
|||
2
app.ts
2
app.ts
|
|
@ -54,7 +54,7 @@ databaseInitializer.initializeDatabase()
|
|||
* PRELOAD CACHES
|
||||
*/
|
||||
|
||||
// preloadCaches()
|
||||
await preloadCaches()
|
||||
|
||||
/*
|
||||
* INITIALIZE APP
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ export declare function getWorkOrderTypeById(workOrderTypeId: number): Promise<r
|
|||
export declare function getWorkOrderMilestoneTypes(): Promise<recordTypes.WorkOrderMilestoneType[]>;
|
||||
export declare function getWorkOrderMilestoneTypeById(workOrderMilestoneTypeId: number): Promise<recordTypes.WorkOrderMilestoneType | undefined>;
|
||||
export declare function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string): Promise<recordTypes.WorkOrderMilestoneType | undefined>;
|
||||
export declare function preloadCaches(): void;
|
||||
export declare function preloadCaches(): Promise<void>;
|
||||
export declare function clearCacheByTableName(tableName: string, relayMessage?: boolean): void;
|
||||
|
|
|
|||
|
|
@ -160,14 +160,14 @@ export async function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrde
|
|||
workOrderMilestoneTypeLowerCase);
|
||||
});
|
||||
}
|
||||
export function preloadCaches() {
|
||||
export async function preloadCaches() {
|
||||
debug('Preloading caches');
|
||||
void getLotOccupantTypes();
|
||||
void getLotStatuses();
|
||||
void getLotTypes();
|
||||
void getOccupancyTypes();
|
||||
void getWorkOrderTypes();
|
||||
void getWorkOrderMilestoneTypes();
|
||||
await getLotOccupantTypes();
|
||||
await getLotStatuses();
|
||||
await getLotTypes();
|
||||
await getOccupancyTypes();
|
||||
await getWorkOrderTypes();
|
||||
await getWorkOrderMilestoneTypes();
|
||||
}
|
||||
function clearWorkOrderMilestoneTypesCache() {
|
||||
workOrderMilestoneTypes = undefined;
|
||||
|
|
|
|||
|
|
@ -298,14 +298,14 @@ export async function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
|||
})
|
||||
}
|
||||
|
||||
export function preloadCaches(): void {
|
||||
export async function preloadCaches(): Promise<void> {
|
||||
debug('Preloading caches')
|
||||
void getLotOccupantTypes()
|
||||
void getLotStatuses()
|
||||
void getLotTypes()
|
||||
void getOccupancyTypes()
|
||||
void getWorkOrderTypes()
|
||||
void getWorkOrderMilestoneTypes()
|
||||
await getLotOccupantTypes()
|
||||
await getLotStatuses()
|
||||
await getLotTypes()
|
||||
await getOccupancyTypes()
|
||||
await getWorkOrderTypes()
|
||||
await getWorkOrderMilestoneTypes()
|
||||
}
|
||||
|
||||
function clearWorkOrderMilestoneTypesCache(): void {
|
||||
|
|
|
|||
Loading…
Reference in New Issue