mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
Fix extension manager resource deadlock (#5066)
Signed-off-by: alexyao2015 <alexyao2015@users.noreply.github.com> Co-authored-by: alexyao2019@gmail.com <alexyao2015@users.noreply.github.com>
This commit is contained in:
@@ -705,9 +705,13 @@ impl ExtensionManager {
|
||||
// Loop through each extension and try to read the resource, don't raise an error if the resource is not found
|
||||
// TODO: do we want to find if a provided uri is in multiple extensions?
|
||||
// currently it will return the first match and skip any others
|
||||
for extension_name in self.extensions.lock().await.keys() {
|
||||
|
||||
// Collect extension names first to avoid holding the lock during iteration
|
||||
let extension_names: Vec<String> = self.extensions.lock().await.keys().cloned().collect();
|
||||
|
||||
for extension_name in extension_names {
|
||||
let result = self
|
||||
.read_resource_from_extension(uri, extension_name, cancellation_token.clone())
|
||||
.read_resource_from_extension(uri, &extension_name, cancellation_token.clone())
|
||||
.await;
|
||||
match result {
|
||||
Ok(result) => return Ok(result),
|
||||
|
||||
Reference in New Issue
Block a user