Avoid initializing rbf cache in worker threads

This commit is contained in:
Mononaut 2023-08-03 18:09:00 +09:00
parent d67285c683
commit 7569c6a394
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 4 additions and 1 deletions

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);
}

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', '*');