@@ -11,7 +11,7 @@ use async_compression::futures::bufread::GzipDecoder;
1111use async_tar:: Archive ;
1212use client:: ExtensionProvides ;
1313use client:: { Client , ExtensionMetadata , GetExtensionsResponse , proto, telemetry:: Telemetry } ;
14- use collections:: { BTreeMap , BTreeSet , HashMap , HashSet , btree_map} ;
14+ use collections:: { BTreeMap , BTreeSet , HashSet , btree_map} ;
1515pub use extension:: ExtensionManifest ;
1616use extension:: extension_builder:: { CompileExtensionOptions , ExtensionBuilder } ;
1717use extension:: {
@@ -43,7 +43,7 @@ use language::{
4343use node_runtime:: NodeRuntime ;
4444use project:: ContextProviderWithTasks ;
4545use release_channel:: ReleaseChannel ;
46- use remote:: { RemoteClient , RemoteConnectionOptions } ;
46+ use remote:: RemoteClient ;
4747use semantic_version:: SemanticVersion ;
4848use serde:: { Deserialize , Serialize } ;
4949use settings:: Settings ;
@@ -123,7 +123,7 @@ pub struct ExtensionStore {
123123 pub wasm_host : Arc < WasmHost > ,
124124 pub wasm_extensions : Vec < ( Arc < ExtensionManifest > , WasmExtension ) > ,
125125 pub tasks : Vec < Task < ( ) > > ,
126- pub remote_clients : HashMap < RemoteConnectionOptions , WeakEntity < RemoteClient > > ,
126+ pub remote_clients : Vec < WeakEntity < RemoteClient > > ,
127127 pub ssh_registered_tx : UnboundedSender < ( ) > ,
128128}
129129
@@ -274,7 +274,7 @@ impl ExtensionStore {
274274 reload_tx,
275275 tasks : Vec :: new ( ) ,
276276
277- remote_clients : HashMap :: default ( ) ,
277+ remote_clients : Default :: default ( ) ,
278278 ssh_registered_tx : connection_registered_tx,
279279 } ;
280280
@@ -348,7 +348,7 @@ impl ExtensionStore {
348348 index_changed = false ;
349349 }
350350
351- Self :: update_ssh_clients ( & this, cx) . await ?;
351+ Self :: update_remote_clients ( & this, cx) . await ?;
352352 }
353353 _ = connection_registered_rx. next( ) => {
354354 debounce_timer = cx
@@ -1725,7 +1725,7 @@ impl ExtensionStore {
17251725 } )
17261726 }
17271727
1728- async fn sync_extensions_over_ssh (
1728+ async fn sync_extensions_to_remotes (
17291729 this : & WeakEntity < Self > ,
17301730 client : WeakEntity < RemoteClient > ,
17311731 cx : & mut AsyncApp ,
@@ -1778,7 +1778,11 @@ impl ExtensionStore {
17781778 } ) ?,
17791779 path_style,
17801780 ) ;
1781- log:: info!( "Uploading extension {}" , missing_extension. clone( ) . id) ;
1781+ log:: info!(
1782+ "Uploading extension {} to {:?}" ,
1783+ missing_extension. clone( ) . id,
1784+ dest_dir
1785+ ) ;
17821786
17831787 client
17841788 . update ( cx, |client, cx| {
@@ -1791,44 +1795,48 @@ impl ExtensionStore {
17911795 missing_extension. clone( ) . id
17921796 ) ;
17931797
1794- client
1798+ let result = client
17951799 . update ( cx, |client, _cx| {
17961800 client. proto_client ( ) . request ( proto:: InstallExtension {
17971801 tmp_dir : dest_dir. to_proto ( ) ,
1798- extension : Some ( missing_extension) ,
1802+ extension : Some ( missing_extension. clone ( ) ) ,
17991803 } )
18001804 } ) ?
1801- . await ?;
1805+ . await ;
1806+
1807+ if let Err ( e) = result {
1808+ log:: error!(
1809+ "Failed to install extension {}: {}" ,
1810+ missing_extension. id,
1811+ e
1812+ ) ;
1813+ }
18021814 }
18031815
18041816 anyhow:: Ok ( ( ) )
18051817 }
18061818
1807- pub async fn update_ssh_clients ( this : & WeakEntity < Self > , cx : & mut AsyncApp ) -> Result < ( ) > {
1819+ pub async fn update_remote_clients ( this : & WeakEntity < Self > , cx : & mut AsyncApp ) -> Result < ( ) > {
18081820 let clients = this. update ( cx, |this, _cx| {
1809- this. remote_clients . retain ( |_k , v| v. upgrade ( ) . is_some ( ) ) ;
1810- this. remote_clients . values ( ) . cloned ( ) . collect :: < Vec < _ > > ( )
1821+ this. remote_clients . retain ( |v| v. upgrade ( ) . is_some ( ) ) ;
1822+ this. remote_clients . clone ( )
18111823 } ) ?;
18121824
18131825 for client in clients {
1814- Self :: sync_extensions_over_ssh ( this, client, cx)
1826+ Self :: sync_extensions_to_remotes ( this, client, cx)
18151827 . await
18161828 . log_err ( ) ;
18171829 }
18181830
18191831 anyhow:: Ok ( ( ) )
18201832 }
18211833
1822- pub fn register_remote_client ( & mut self , client : Entity < RemoteClient > , cx : & mut Context < Self > ) {
1823- let options = client. read ( cx) . connection_options ( ) ;
1824-
1825- if let Some ( existing_client) = self . remote_clients . get ( & options)
1826- && existing_client. upgrade ( ) . is_some ( )
1827- {
1828- return ;
1829- }
1830-
1831- self . remote_clients . insert ( options, client. downgrade ( ) ) ;
1834+ pub fn register_remote_client (
1835+ & mut self ,
1836+ client : Entity < RemoteClient > ,
1837+ _cx : & mut Context < Self > ,
1838+ ) {
1839+ self . remote_clients . push ( client. downgrade ( ) ) ;
18321840 self . ssh_registered_tx . unbounded_send ( ( ) ) . ok ( ) ;
18331841 }
18341842}
0 commit comments