fix: read_resource_tool deadlock causing test_compaction to hang (#6737)
This commit is contained in:
@@ -973,9 +973,14 @@ 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
|
||||
|
||||
// Collect extension names first to avoid holding the lock during iteration
|
||||
let extension_names: Vec<String> = self.extensions.lock().await.keys().cloned().collect();
|
||||
let extension_names: Vec<String> = self
|
||||
.extensions
|
||||
.lock()
|
||||
.await
|
||||
.iter()
|
||||
.filter(|(_name, ext)| ext.supports_resources())
|
||||
.map(|(name, _)| name.clone())
|
||||
.collect();
|
||||
|
||||
for extension_name in extension_names {
|
||||
let read_result = self
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ in your tool specification.
|
||||
|
||||
## test
|
||||
|
||||
test supports resources, you can use platform__read_resource,
|
||||
and platform__list_resources on this extension.
|
||||
test supports resources, you can use extensionmanager__read_resource,
|
||||
and extensionmanager__list_resources on this extension.
|
||||
### Instructions
|
||||
how to use this extension
|
||||
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ in your tool specification.
|
||||
|
||||
## extension_A
|
||||
|
||||
extension_A supports resources, you can use platform__read_resource,
|
||||
and platform__list_resources on this extension.
|
||||
extension_A supports resources, you can use extensionmanager__read_resource,
|
||||
and extensionmanager__list_resources on this extension.
|
||||
### Instructions
|
||||
<instructions on how to use extension A>
|
||||
## extension_B
|
||||
|
||||
@@ -31,8 +31,8 @@ in your tool specification.
|
||||
## {{extension.name}}
|
||||
|
||||
{% if extension.has_resources %}
|
||||
{{extension.name}} supports resources, you can use platform__read_resource,
|
||||
and platform__list_resources on this extension.
|
||||
{{extension.name}} supports resources, you can use extensionmanager__read_resource,
|
||||
and extensionmanager__list_resources on this extension.
|
||||
{% endif %}
|
||||
{% if extension.instructions %}### Instructions
|
||||
{{extension.instructions}}{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user