This commit is contained in:
Viktoria Polyakova
2026-01-25 08:57:38 +00:00
commit 4fb101c5db
7657 changed files with 497012 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { DateUtil } from '@/common';
import { SupportConfig } from '../config';
@Injectable()
export class HeapdumpService {
private readonly _config: SupportConfig | undefined;
constructor(private readonly configService: ConfigService) {
this._config = this.configService.get<SupportConfig>('support');
}
public async writeSnapshot(code: string) {
if (this._config?.accessCode && this._config.accessCode === code) {
try {
const { writeSnapshot } = await import('heapdump');
writeSnapshot(`heapdump-${DateUtil.now().toISOString()}.heapsnapshot`);
} catch (error) {
console.error('Heapdump not available:', error);
}
}
}
}