File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ pub struct ProjectControlPlaneClient {
1212 project_id : String ,
1313 server_url : String ,
1414 access_token : String ,
15- client : Client ,
15+ client : Arc < Client > ,
1616}
1717
1818impl ProjectControlPlaneClient {
@@ -29,7 +29,7 @@ impl ProjectControlPlaneClient {
2929 }
3030
3131 pub fn client ( & self ) -> & Client {
32- & self . client
32+ self . client . as_ref ( )
3333 }
3434}
3535
@@ -51,6 +51,8 @@ impl ProjectControlPlaneManager {
5151 self . current . load_full ( ) . as_ref ( ) . clone ( )
5252 }
5353
54+ /// Returns the current project client, refreshing the auth token if needed.
55+ /// The client is rebuilt when the token changes ("refresh on access").
5456 pub async fn client ( & self ) -> Result < Option < ProjectControlPlaneClient > > {
5557 let current = self . current . load_full ( ) ;
5658 let Some ( current) = current. as_ref ( ) . as_ref ( ) else {
@@ -133,7 +135,7 @@ impl DatumCloudClient {
133135 project_id : project_id. to_string ( ) ,
134136 server_url,
135137 access_token : access_token. to_string ( ) ,
136- client,
138+ client : Arc :: new ( client ) ,
137139 } )
138140 }
139141}
You can’t perform that action at this time.
0 commit comments