File tree 1 file changed +17
-15
lines changed
1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,7 @@ pub trait Backend: Debug + Send + Sync {
199
199
200
200
fn list_remote_versions ( & self ) -> eyre:: Result < Vec < String > > {
201
201
self . get_remote_version_cache ( )
202
+ // TODO: fix deadlock
202
203
. get_or_try_init ( || {
203
204
trace ! ( "Listing remote versions for {}" , self . ba( ) . to_string( ) ) ;
204
205
match versions_host:: list_versions ( self . ba ( ) ) {
@@ -630,23 +631,24 @@ pub trait Backend: Debug + Send + Sync {
630
631
static REMOTE_VERSION_CACHE : Lazy < Mutex < HashMap < String , Arc < VersionCacheManager > > > > =
631
632
Lazy :: new ( || Mutex :: new ( HashMap :: new ( ) ) ) ;
632
633
633
- // REMOTE_VERSION_CACHE
634
- // .lock()
635
- // .unwrap()
636
- // .entry(self.ba().full())
637
- // .or_insert_with(|| {
638
- let mut cm =
639
- CacheManagerBuilder :: new ( self . ba ( ) . cache_path . join ( "remote_versions.msgpack.z" ) )
634
+ REMOTE_VERSION_CACHE
635
+ . lock ( )
636
+ . unwrap ( )
637
+ . entry ( self . ba ( ) . full ( ) )
638
+ . or_insert_with ( || {
639
+ let mut cm = CacheManagerBuilder :: new (
640
+ self . ba ( ) . cache_path . join ( "remote_versions.msgpack.z" ) ,
641
+ )
640
642
. with_fresh_duration ( SETTINGS . fetch_remote_versions_cache ( ) ) ;
641
- if let Some ( plugin_path) = self . plugin ( ) . map ( |p| p. path ( ) ) {
642
- cm = cm
643
- . with_fresh_file ( plugin_path. clone ( ) )
644
- . with_fresh_file ( plugin_path. join ( "bin/list-all" ) )
645
- }
643
+ if let Some ( plugin_path) = self . plugin ( ) . map ( |p| p. path ( ) ) {
644
+ cm = cm
645
+ . with_fresh_file ( plugin_path. clone ( ) )
646
+ . with_fresh_file ( plugin_path. join ( "bin/list-all" ) )
647
+ }
646
648
647
- Arc :: new ( cm. build ( ) )
648
- // })
649
- // .clone()
649
+ Arc :: new ( cm. build ( ) )
650
+ } )
651
+ . clone ( )
650
652
}
651
653
652
654
fn verify_checksum (
You can’t perform that action at this time.
0 commit comments