mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: store snapshots in temp folder (#2864)
This commit is contained in:
		
							parent
							
								
									8e5aeff1a7
								
							
						
					
					
						commit
						0c1e997f0b
					
				| @ -1,4 +1,6 @@ | ||||
| import { writeHeapSnapshot } from 'v8'; | ||||
| import { tmpdir } from 'os'; | ||||
| import { join } from 'path'; | ||||
| import { register as prometheusRegister } from 'prom-client'; | ||||
| import Controller from './controller'; | ||||
| import { IUnleashConfig } from '../types/option'; | ||||
| @ -20,7 +22,11 @@ class BackstageController extends Controller { | ||||
| 
 | ||||
|         if (config.server.enableHeapSnapshotEnpoint) { | ||||
|             this.get('/heap-snapshot', async (req, res) => { | ||||
|                 writeHeapSnapshot(); | ||||
|                 const fileName = join( | ||||
|                     tmpdir(), | ||||
|                     `unleash-${Date.now()}.heapsnapshot`, | ||||
|                 ); | ||||
|                 writeHeapSnapshot(fileName); | ||||
|                 res.status(200); | ||||
|                 res.end('Snapshot written'); | ||||
|             }); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user