@@ -334,10 +334,10 @@ impl DenoRuntime {
334
334
335
335
{
336
336
//run inside a closure, so op_state_rc is released
337
- let env_vars = env_vars. clone ( ) ;
338
337
let op_state_rc = js_runtime. op_state ( ) ;
339
338
let mut op_state = op_state_rc. borrow_mut ( ) ;
340
- op_state. put :: < sb_env:: EnvVars > ( env_vars) ;
339
+
340
+ let mut env_vars = env_vars. clone ( ) ;
341
341
342
342
if conf. is_events_worker ( ) {
343
343
// if worker is an events worker, assert events_rx is to be available
@@ -347,6 +347,13 @@ impl DenoRuntime {
347
347
348
348
if conf. is_user_worker ( ) {
349
349
let conf = conf. as_user_worker ( ) . unwrap ( ) ;
350
+
351
+ // set execution id for user workers
352
+ env_vars. insert (
353
+ "SB_EXECUTION_ID" . to_string ( ) ,
354
+ conf. key . map_or ( "" . to_string ( ) , |k| k. to_string ( ) ) ,
355
+ ) ;
356
+
350
357
if let Some ( events_msg_tx) = conf. events_msg_tx . clone ( ) {
351
358
op_state. put :: < mpsc:: UnboundedSender < WorkerEventWithMetadata > > ( events_msg_tx) ;
352
359
op_state. put :: < EventMetadata > ( EventMetadata {
@@ -355,6 +362,8 @@ impl DenoRuntime {
355
362
} ) ;
356
363
}
357
364
}
365
+
366
+ op_state. put :: < sb_env:: EnvVars > ( env_vars) ;
358
367
}
359
368
360
369
let main_module_id = js_runtime
0 commit comments