File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,16 +35,20 @@ pub async fn init() -> Result<(), Box<dyn Error>> {
3535 get_jinja_engine ( ) ;
3636 tracing:: info!( "init jinja done!" ) ;
3737 tracing:: info!( "init chromium..." ) ;
38- loop {
39- match get_chromium_tab ( ) {
40- Ok ( _) => {
41- tracing:: info!( "init chromium done!" ) ;
42- return Ok ( ( ) ) ;
38+ tokio:: task:: spawn_blocking ( move || {
39+ loop {
40+ match get_chromium_tab ( ) {
41+ Ok ( _) => {
42+ tracing:: info!( "init chrome done!" ) ;
43+ break ;
44+ }
45+ Err ( e) => tracing:: warn!( "chrome not available yet! will try again in a sec...{e}" ) ,
4346 }
44- Err ( e ) => tracing :: warn! ( "chrome not available yet! will try again in a sec...{e}" ) ,
47+ std :: thread :: sleep ( Duration :: from_secs ( 30 ) ) ;
4548 }
46- tokio:: time:: sleep ( Duration :: from_secs ( 30 ) ) . await ;
47- }
49+ } )
50+ . await ?;
51+ Ok ( ( ) )
4852}
4953
5054pub async fn render < T : Serialize + Debug > (
@@ -162,7 +166,7 @@ pub fn get_chromium_tab() -> Result<Arc<Tab>, Box<dyn Error>> {
162166 // OsStr::new("--disable-setuid-sandbox"),
163167 OsStr :: new( "--disable-features=IsolateOrigins,site-per-process" ) ,
164168 // OsStr::new("--default-background-color=00000000"),
165- OsStr :: new( "--disable-dev-shm-usage" ) ,
169+ OsStr :: new( "--disable-dev-shm-usage" ) ,
166170 & user_data_dir,
167171 ] )
168172 . build ( )
You can’t perform that action at this time.
0 commit comments