chore(singletons): remove singleton pattern in dev mode

This commit is contained in:
Nicolas Meienberger 2024-03-18 22:40:21 +01:00
parent 0e76454740
commit 7ab6463ac3
2 changed files with 0 additions and 6 deletions

View File

@ -73,5 +73,3 @@ const tipiCacheSingleton = () => {
return new TipiCacheClass();
};
export const tipiCache = globalThis.TipiCache ?? tipiCacheSingleton();
if (process.env.NODE_ENV !== 'production') globalThis.TipiCache = tipiCache;

View File

@ -42,7 +42,6 @@ export class AppServiceClass {
private cacheLastUpdated = 0;
constructor(p: Database = db) {
Logger.debug('AppServiceClass constructor');
this.queries = new AppQueries(p);
}
@ -56,7 +55,6 @@ export class AppServiceClass {
private async getAvailableApps() {
// Invalidate cache if it's older than 15 minutes
if (this.cacheLastUpdated && Date.now() - this.cacheLastUpdated > this.cacheTimeout) {
Logger.debug('apps service -> invalidateCache');
this.invalidateCache();
}
@ -533,5 +531,3 @@ const appServiceSingleton = () => {
return new AppServiceClass();
};
export const appService = globalThis.AppService ?? appServiceSingleton();
if (process.env.NODE_ENV !== 'production') globalThis.AppService = appService;