@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
3
3
use anyhow:: { bail, ensure, Context , Result } ;
4
4
use futures:: future:: try_join_all;
5
5
use reqwest:: Url ;
6
- use spin_common:: { paths:: parent_dir, ui:: quoted_path} ;
6
+ use spin_common:: { paths:: parent_dir, sloth , ui:: quoted_path} ;
7
7
use spin_locked_app:: {
8
8
locked:: {
9
9
self , ContentPath , ContentRef , LockedApp , LockedComponent , LockedComponentSource ,
@@ -94,6 +94,8 @@ impl LocalLoader {
94
94
} )
95
95
. collect :: < Result < Vec < _ > > > ( ) ?;
96
96
97
+ warn_if_component_load_slothful ( ) ;
98
+
97
99
// Load all components concurrently
98
100
let components = try_join_all ( components. into_iter ( ) . map ( |( id, c) | async move {
99
101
self . load_component ( & id, c)
@@ -516,3 +518,10 @@ fn file_url(path: impl AsRef<Path>) -> Result<String> {
516
518
. with_context ( || format ! ( "Couldn't resolve `{}`" , path. display( ) ) ) ?;
517
519
Ok ( Url :: from_file_path ( abs_path) . unwrap ( ) . to_string ( ) )
518
520
}
521
+
522
+ const SLOTH_WARNING_DELAY_MILLIS : u64 = 1250 ;
523
+
524
+ fn warn_if_component_load_slothful ( ) -> sloth:: SlothGuard {
525
+ let message = "WASM components loading is taking a few seconds..." ;
526
+ sloth:: warn_if_slothful ( SLOTH_WARNING_DELAY_MILLIS , format ! ( "{message}\n " ) )
527
+ }
0 commit comments