Avoid initializing rbf cache in worker threads

This commit is contained in:
Mononaut committed 2023-08-24 22:01:20 +09:00
1 parent a509a52993
commit 20a8725450
2 files changed
+4 -1

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ class RbfCache {
private expiring: Map<string, number> = new Map();
private cacheQueue: CacheEvent[] = [];
constructor() {
public init(): void {
setInterval(this.cleanup.bind(this), 1000 * 60 * 10);
}
+3
View File
@@ -43,6 +43,7 @@ import { AxiosError } from 'axios';
import v8 from 'v8';
import { formatBytes, getBytesUnit } from './utils/format';
import redisCache from './api/redis-cache';
import rbfCache from './api/rbf-cache';
class Server {
private wss: WebSocket.Server | undefined;
@@ -107,6 +108,8 @@ class Server {
}
}
rbfCache.init();
this.app
.use((req: Request, res: Response, next: NextFunction) => {
res.setHeader('Access-Control-Allow-Origin', '*');