File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,16 @@ enum Status<Value> {
185185 ) ,
186186}
187187
188+ impl < Value > std:: fmt:: Display for Status < Value > {
189+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
190+ match self {
191+ Status :: Ready ( _) => write ! ( f, "Ready" ) ,
192+ Status :: Waiting ( _) => write ! ( f, "Waiting" ) ,
193+ Status :: Kickoff ( ..) => write ! ( f, "Kickoff" ) ,
194+ }
195+ }
196+ }
197+
188198impl <
189199 RT : Runtime ,
190200 Key : Hash + Eq + Debug + Clone + Send + Sync + ' static ,
@@ -370,7 +380,9 @@ impl<
370380 key : & Key ,
371381 value_generator : ValueGenerator < Key , Value > ,
372382 ) -> anyhow:: Result < Arc < Value > > {
373- match self . get_sync ( key, value_generator) ? {
383+ let status = self . get_sync ( key, value_generator) ?;
384+ tracing:: debug!( "Getting key {key:?} with status {status}" ) ;
385+ match status {
374386 Status :: Ready ( value) => Ok ( value) ,
375387 Status :: Waiting ( rx) => Ok ( Self :: wait_for_value ( key, rx) . await ?) ,
376388 Status :: Kickoff ( rx, timer) => {
Original file line number Diff line number Diff line change @@ -379,10 +379,13 @@ impl<RT: Runtime> ArchiveCacheManager<RT> {
379379 . get (
380380 cache_key. clone ( ) ,
381381 archive_fetcher
382- . generate_value ( search_storage, key. clone ( ) , search_file_type)
382+ . generate_value ( search_storage. clone ( ) , key. clone ( ) , search_file_type)
383383 . boxed ( ) ,
384384 )
385- . await ?;
385+ . await
386+ . with_context ( || {
387+ format ! ( "Failed to get cache_key {cache_key:?} in {search_storage:?}" )
388+ } ) ?;
386389
387390 let path = result. path . clone ( ) ;
388391 let current_size = self . cache . size ( ) ;
Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ use tokio::io::AsyncRead;
1818pub mod cache;
1919mod metrics;
2020
21- /// Extract the archive stream to the specified output directory, which must not
22- /// exist or this method will return an Error . This function should only be used
21+ /// Extract the archive stream to the specified output directory, which will be
22+ /// created if it doesn't already exist . This function should only be used
2323/// for trusted ZIP archives; we don't make any attempt to guard against
2424/// directory traversal attacks nor do we sanitize paths.
2525pub ( crate ) async fn extract_zip < P : AsRef < Path > > (
2626 output_directory : P ,
2727 archive : impl AsyncRead ,
2828) -> anyhow:: Result < u64 > {
29- std:: fs:: create_dir ( & output_directory) ?;
29+ std:: fs:: create_dir_all ( & output_directory) ?;
3030 pin_mut ! ( archive) ;
3131 let mut reader = ZipFileReader :: new ( archive) ;
3232 let mut created_paths: HashSet < PathBuf > = HashSet :: new ( ) ;
You can’t perform that action at this time.
0 commit comments