File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,11 @@ export async function loader({ request }: DataFunctionArgs) {
32
32
throw new Response ( "You must be an admin to perform this action" , { status : 403 } ) ;
33
33
}
34
34
35
- const host = request . headers . get ( "X-Forwarded-Host" ) ?? request . headers . get ( "host" ) ;
36
-
37
35
const tempDir = os . tmpdir ( ) ;
38
- const filepath = path . join ( tempDir , `${ host } -${ formatDate ( new Date ( ) ) } .heapsnapshot` ) ;
36
+ const filepath = path . join (
37
+ tempDir ,
38
+ `${ getTaskIdentifier ( ) } -${ formatDate ( new Date ( ) ) } .heapsnapshot`
39
+ ) ;
39
40
40
41
const snapshotPath = v8 . writeHeapSnapshot ( filepath ) ;
41
42
if ( ! snapshotPath ) {
@@ -57,3 +58,13 @@ export async function loader({ request }: DataFunctionArgs) {
57
58
} ,
58
59
} ) ;
59
60
}
61
+
62
+ function getTaskIdentifier ( ) {
63
+ if ( ! process . env . ECS_CONTAINER_METADATA_URI ) {
64
+ return "local" ;
65
+ }
66
+
67
+ const url = new URL ( process . env . ECS_CONTAINER_METADATA_URI ) ;
68
+
69
+ return url . pathname . split ( "/" ) [ 2 ] . split ( "-" ) [ 0 ] ;
70
+ }
You can’t perform that action at this time.
0 commit comments