fix(connlib): update resource list on resource removal (#3796)

oops
This commit is contained in:
Gabi
2024-02-28 14:34:39 -03:00
committed by GitHub
parent 9e11ddb1cd
commit 2f72e225f8

View File

@@ -83,14 +83,8 @@ where
.resource_ids
.insert(resource_description.id(), resource_description);
self.callbacks.on_update_resources(
self.role_state
.resource_ids
.values()
.sorted()
.cloned()
.collect_vec(),
)?;
self.update_resource_list()?;
Ok(())
}
@@ -113,6 +107,10 @@ where
}
}
if let Err(err) = self.update_resource_list() {
tracing::error!("Failed to update resource list: {err:#?}")
}
let Some(gateway_id) = self.role_state.resources_gateways.remove(&id) else {
return;
};
@@ -150,6 +148,18 @@ where
}
}
fn update_resource_list(&self) -> connlib_shared::Result<()> {
self.callbacks.on_update_resources(
self.role_state
.resource_ids
.values()
.sorted()
.cloned()
.collect_vec(),
)?;
Ok(())
}
/// Sets the interface configuration and starts background tasks.
#[tracing::instrument(level = "trace", skip(self))]
pub fn set_interface(