-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5829 load plugins via processor #6399
base: 6396-CLI-to-generate-and-isntall-plugin-bundle
Are you sure you want to change the base?
5829 load plugins via processor #6399
Conversation
β¦29-load-plugins-via-processor
@@ -16,8 +16,9 @@ table! { | |||
} | |||
} | |||
|
|||
// Database: https://github.com/openmsupply/open-msupply/blob/d6645711184c63593949c3e8b6dc96b5a5ded39f/server/repository/migrations/postgres/2022-02-11T15-00_create_key_value_store/up.sql#L2-L16 | |||
// Snippet for adding new, including migration : https://github.com/msupply-foundation/open-msupply/wiki/Snippets "New Key Type for KeyValueStore" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a snippet for this, for future additions
#[derive(DbEnum, Debug, Clone, PartialEq, Eq, Default)] | ||
#[cfg_attr(test, derive(strum::EnumIter))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test wasn't stricly necessary, but was quick to add and doesn't add too much extra code, sorry to the reviewer
@@ -147,11 +147,14 @@ pub async fn start_server( | |||
} | |||
|
|||
// PLUGIN CONTEXT | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry for format change
} | ||
|
||
ctx.processors_trigger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A trigger would work here, since rows have been upserted
|
||
#[derive(Error, Debug)] | ||
pub(crate) enum ProcessorError { | ||
#[error("{0:?} not found: {1:?}")] | ||
#[error("{0} not found: {1}")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chnaged error mapping, tehnically should just do [source]
or from for existing error and they will be added to the error message without needing to print them out
changelog.record_id.clone(), | ||
))?; | ||
|
||
PluginInstance::bind(plugin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty simple processor to just just call 'bind'
Fixes #5829
π©π»βπ» What does this PR do?
Adds a new processor to load plugins to plugin provider (so that after sync plugins are loaded without restart).
Plugins are also loaded at startup.
Added enum test, key_type_enum, to make sure key types in key value store match database type definitions
π Any notes for the reviewer?
π§ͺ Testing
Setup remote site and central site on this version. Sync them. Then run
cargo run --bin remote_server_cli -- generate-and-install-plugin-bundle -i './service/src/backend_plugin/examples/amc' -u 'http://localhost:8000' --username 'test' --password 'pass'
Above will upload plugin to central sever, after syncing remote site you should see AMC calculated per amc.js file. On servers restart you should still see AMC calculater as per amc.js file