File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: server:: { Server , ServerCodes , WorkerEntrypoints } ;
2
2
use anyhow:: Error ;
3
3
use deno_core:: JsRuntime ;
4
+ use log:: error;
4
5
use tokio:: sync:: mpsc:: Sender ;
5
6
6
7
#[ allow( clippy:: too_many_arguments) ]
@@ -14,6 +15,8 @@ pub async fn start_server(
14
15
callback_tx : Option < Sender < ServerCodes > > ,
15
16
entrypoints : WorkerEntrypoints ,
16
17
) -> Result < ( ) , Error > {
18
+ set_v8_flags ( ) ;
19
+
17
20
// NOTE(denoland/deno/20495): Due to the new PKU (Memory Protection Keys)
18
21
// feature introduced in V8 11.6, We need to initialize the V8 platform on
19
22
// the main thread that spawns V8 isolates.
@@ -32,3 +35,20 @@ pub async fn start_server(
32
35
. await ?;
33
36
server. listen ( ) . await
34
37
}
38
+
39
+ fn set_v8_flags ( ) {
40
+ let v8_flags = std:: env:: var ( "V8_FLAGS" ) . unwrap_or ( "" . to_string ( ) ) ;
41
+ let mut vec = vec ! [ "" ] ;
42
+
43
+ if v8_flags. is_empty ( ) {
44
+ return ;
45
+ }
46
+
47
+ vec. append ( & mut v8_flags. split ( ' ' ) . collect ( ) ) ;
48
+
49
+ let ignored = deno_core:: v8_set_flags ( vec. iter ( ) . map ( |v| v. to_string ( ) ) . collect ( ) ) ;
50
+
51
+ if * ignored. as_slice ( ) != [ "" ] {
52
+ error ! ( "v8 flags unrecognized {:?}" , ignored) ;
53
+ }
54
+ }
Original file line number Diff line number Diff line change @@ -58,20 +58,6 @@ fn get_error_class_name(e: &AnyError) -> &'static str {
58
58
sb_core:: errors_rt:: get_error_class_name ( e) . unwrap_or ( "Error" )
59
59
}
60
60
61
- fn set_v8_flags ( ) {
62
- let v8_flags = std:: env:: var ( "V8_FLAGS" ) . unwrap_or ( "" . to_string ( ) ) ;
63
- let mut vec = vec ! [ "IGNORED" ] ;
64
- if v8_flags. is_empty ( ) {
65
- return ;
66
- }
67
-
68
- vec. append ( & mut v8_flags. split ( ' ' ) . collect ( ) ) ;
69
- error ! (
70
- "v8 flags unrecognized {:?}" ,
71
- deno_core:: v8_set_flags( vec. iter( ) . map( |v| v. to_string( ) ) . collect( ) )
72
- ) ;
73
- }
74
-
75
61
pub struct DenoRuntime {
76
62
pub js_runtime : JsRuntime ,
77
63
pub env_vars : HashMap < String , String > , // TODO: does this need to be pub?
@@ -95,8 +81,6 @@ impl DenoRuntime {
95
81
maybe_module_code,
96
82
} = opts;
97
83
98
- set_v8_flags ( ) ;
99
-
100
84
let user_agent = "supabase-edge-runtime" . to_string ( ) ;
101
85
let base_dir_path = std:: env:: current_dir ( ) . map ( |p| p. join ( & service_path) ) ?;
102
86
let base_url = Url :: from_directory_path ( & base_dir_path) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments