mirror of
https://github.com/civitai/civitai.git
synced 2026-09-20 22:08:18 +08:00
Attempt a GC before taking a snapshot
This commit is contained in:
+1
-1
@@ -68,4 +68,4 @@ EXPOSE 3000
|
||||
ENV PORT 3000
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
CMD ["pm2-runtime", "node", "--", "server.js"]
|
||||
CMD ["pm2-runtime", "node", "--", "server.js", "--", "--expose-gc"]
|
||||
|
||||
@@ -5,6 +5,9 @@ import { createReadStream } from 'node:fs';
|
||||
|
||||
export default JobEndpoint(async function getHeapDump(req: NextApiRequest, res: NextApiResponse) {
|
||||
const localPath = `/tmp/heapdump-${Date.now()}.heapsnapshot`;
|
||||
if (global.gc) {
|
||||
global.gc();
|
||||
}
|
||||
writeHeapSnapshot(localPath);
|
||||
|
||||
const readStream = createReadStream(localPath);
|
||||
|
||||
Reference in New Issue
Block a user