Page MenuHomePhabricator

D12649.diff
No OneTemporary

D12649.diff

diff --git a/services/identity/src/database/device_list.rs b/services/identity/src/database/device_list.rs
--- a/services/identity/src/database/device_list.rs
+++ b/services/identity/src/database/device_list.rs
@@ -1380,7 +1380,8 @@
"Attempting to delete Tunnelbroker data for device: {}",
&device_id
);
- let result = crate::tunnelbroker::delete_device_data(&device_id).await;
+ let result =
+ crate::tunnelbroker::delete_devices_data(&[device_id]).await;
consume_error(result);
});
}
diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs
--- a/services/identity/src/grpc_services/authenticated.rs
+++ b/services/identity/src/grpc_services/authenticated.rs
@@ -95,14 +95,13 @@
Ok((user_id, device_id))
}
-fn spawn_delete_tunnelbroker_data_task(device_id: &str) {
- let device_id = device_id.to_string();
+fn spawn_delete_tunnelbroker_data_task(device_ids: Vec<String>) {
tokio::spawn(async move {
debug!(
- "Attempting to delete Tunnelbroker data for device: {}",
- &device_id
+ "Attempting to delete Tunnelbroker data for devices: {:?}",
+ device_ids.as_slice()
);
- let result = crate::tunnelbroker::delete_device_data(&device_id).await;
+ let result = crate::tunnelbroker::delete_devices_data(&device_ids).await;
consume_error(result);
});
}
@@ -425,7 +424,7 @@
consume_error(result);
});
- spawn_delete_tunnelbroker_data_task(&device_id);
+ spawn_delete_tunnelbroker_data_task([device_id].into());
let response = Empty {};
Ok(Response::new(response))
@@ -498,13 +497,13 @@
.map_err(handle_db_error)?;
debug!(user_id, "Attempting to delete user's devices");
- let _device_ids = self
+ let device_ids = self
.db_client
.delete_devices_data_for_user(&user_id)
.await
.map_err(handle_db_error)?;
- // TODO: Remove Tunnelbroker data (use the _device_ids)
+ spawn_delete_tunnelbroker_data_task(device_ids);
let response = Empty {};
Ok(Response::new(response))
@@ -541,7 +540,7 @@
.await
.map_err(handle_db_error)?;
- spawn_delete_tunnelbroker_data_task(&device_id);
+ spawn_delete_tunnelbroker_data_task([device_id].into());
let response = Empty {};
Ok(Response::new(response))
diff --git a/services/identity/src/tunnelbroker.rs b/services/identity/src/tunnelbroker.rs
--- a/services/identity/src/tunnelbroker.rs
+++ b/services/identity/src/tunnelbroker.rs
@@ -73,14 +73,15 @@
Ok(())
}
-pub async fn delete_device_data(
- device_id: &str,
-) -> Result<Response<Empty>, Error> {
+pub async fn delete_devices_data(device_ids: &[String]) -> Result<(), Error> {
let mut tunnelbroker_client = create_tunnelbroker_client().await?;
- let request = DeleteDeviceDataRequest {
- device_id: device_id.to_string(),
- };
- let grpc_message = tonic::Request::new(request);
- Ok(tunnelbroker_client.delete_device_data(grpc_message).await?)
+ for device_id in device_ids {
+ let request = DeleteDeviceDataRequest {
+ device_id: device_id.to_string(),
+ };
+ let grpc_message = tonic::Request::new(request);
+ tunnelbroker_client.delete_device_data(grpc_message).await?;
+ }
+ Ok(())
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 9:41 PM (17 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2565359
Default Alt Text
D12649.diff (3 KB)

Event Timeline