Conversation
a21ede2 to
2216744
Compare
Nutomic
commented
Mar 13, 2025
5 tasks
dessalines
reviewed
Mar 18, 2025
Member
Author
|
This and the RFC are ready to merge, so that devs can already start to work on plugins. |
dessalines
reviewed
Mar 24, 2025
Comment on lines
+34
to
+46
| for p in plugins.0 { | ||
| // TODO: add helper method (requires PoolPlugin to be public) | ||
| // https://github.com/extism/extism/pull/696/files#r2003467812 | ||
| let p = p | ||
| .plugin_pool | ||
| .get(&(), GET_PLUGIN_TIMEOUT)? | ||
| .ok_or(anyhow!("plugin timeout"))?; | ||
| if p.plugin().function_exists(name) { | ||
| let params: Json<T> = data.clone().into(); | ||
| p.call::<Json<T>, ()>(name, params) | ||
| .map_err(|e| LemmyErrorType::PluginError(e.to_string()))?; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Could you externalize this to a function?
Member
Author
There was a problem hiding this comment.
Unfortunately not, because the PoolPlugin type is not public (thats what the todo is for, I left a review comment in the upstream PR so it will hopefully get fixed later). The plugin call can also not be externalized, because the pre hook needs to return data but the post hook not.
crates/api_common/src/plugins.rs
Outdated
| *data = res; | ||
| let mut plugins = LemmyPlugins::init(); | ||
| let mut res: Json<T> = data.clone().into(); | ||
| for p in &mut plugins.0 { |
dessalines
reviewed
Mar 24, 2025
dessalines
approved these changes
Mar 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See LemmyNet/rfcs#8 and #4695. Depends on a work in progress feature of Extism to add plugin pools for concurrency (extism/extism#696).
Todo:
/api/v4/site