Skip to content

Commit a28e5a3

Browse files
committed
chore: cleanup
1 parent a4a9c34 commit a28e5a3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/src/project_control_plane.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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

1818
impl 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
}

0 commit comments

Comments
 (0)