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
|
// 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?
|
// 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
|
// currently it will return the first match and skip any others
|
||||||
|
let extension_names: Vec<String> = self
|
||||||
// Collect extension names first to avoid holding the lock during iteration
|
.extensions
|
||||||
let extension_names: Vec<String> = self.extensions.lock().await.keys().cloned().collect();
|
.lock()
|
||||||
|
.await
|
||||||
|
.iter()
|
||||||
|
.filter(|(_name, ext)| ext.supports_resources())
|
||||||
|
.map(|(name, _)| name.clone())
|
||||||
|
.collect();
|
||||||
|
|
||||||
for extension_name in extension_names {
|
for extension_name in extension_names {
|
||||||
let read_result = self
|
let read_result = self
|
||||||
|
|||||||
+2
-2
@@ -31,8 +31,8 @@ in your tool specification.
|
|||||||
|
|
||||||
## test
|
## test
|
||||||
|
|
||||||
test supports resources, you can use platform__read_resource,
|
test supports resources, you can use extensionmanager__read_resource,
|
||||||
and platform__list_resources on this extension.
|
and extensionmanager__list_resources on this extension.
|
||||||
### Instructions
|
### Instructions
|
||||||
how to use this extension
|
how to use this extension
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -31,8 +31,8 @@ in your tool specification.
|
|||||||
|
|
||||||
## extension_A
|
## extension_A
|
||||||
|
|
||||||
extension_A supports resources, you can use platform__read_resource,
|
extension_A supports resources, you can use extensionmanager__read_resource,
|
||||||
and platform__list_resources on this extension.
|
and extensionmanager__list_resources on this extension.
|
||||||
### Instructions
|
### Instructions
|
||||||
<instructions on how to use extension A>
|
<instructions on how to use extension A>
|
||||||
## extension_B
|
## extension_B
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ in your tool specification.
|
|||||||
## {{extension.name}}
|
## {{extension.name}}
|
||||||
|
|
||||||
{% if extension.has_resources %}
|
{% if extension.has_resources %}
|
||||||
{{extension.name}} supports resources, you can use platform__read_resource,
|
{{extension.name}} supports resources, you can use extensionmanager__read_resource,
|
||||||
and platform__list_resources on this extension.
|
and extensionmanager__list_resources on this extension.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if extension.instructions %}### Instructions
|
{% if extension.instructions %}### Instructions
|
||||||
{{extension.instructions}}{% endif %}
|
{{extension.instructions}}{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user