parent
6182a1cb2c
commit
e8420ad90b
10 changed files with 117 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { AccessTokensRepository, AppsRepository, UsersRepository } from '@/models/index.js';
|
||||
import type { LocalUser } from '@/models/entities/User.js';
|
||||
|
@ -17,7 +17,7 @@ export class AuthenticationError extends Error {
|
|||
}
|
||||
|
||||
@Injectable()
|
||||
export class AuthenticateService {
|
||||
export class AuthenticateService implements OnApplicationShutdown {
|
||||
private appCache: MemoryKVCache<App>;
|
||||
|
||||
constructor(
|
||||
|
@ -85,4 +85,14 @@ export class AuthenticateService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public dispose(): void {
|
||||
this.appCache.dispose();
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public onApplicationShutdown(signal?: string | undefined): void {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue