Skip to content

Commit

Permalink
fix(coffee): only upgrade plugins if needed
Browse files Browse the repository at this point in the history
Revise the plugin upgrade logic to only perform upgrades to plugins if the repository was updated. This prevents unnecessary plugin upgrades

Signed-off-by: Tarek <[email protected]>
  • Loading branch information
tareknaser authored and vincenzopalazzo committed Feb 6, 2024
1 parent 1b0a9bf commit dd21877
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions coffee_core/src/coffee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,18 @@ impl PluginManager for CoffeeManager {
.ok_or_else(|| error!("Repository with name: `{}` not found", repo))?;

let status = repository.upgrade(&self.config.plugins, verbose).await?;
for plugins in status.plugins_effected.iter() {
self.remove(plugins).await?;
self.install(plugins, verbose, false).await?;

// if status is not up to date, we need to update the plugins as well
match status.status {
UpgradeStatus::Updated(_, _) => {
for plugins in status.plugins_effected.iter() {
self.remove(plugins).await?;
self.install(plugins, verbose, false).await?;
}
}
_ => {}
}

self.flush().await?;
Ok(status)
}
Expand Down

0 comments on commit dd21877

Please sign in to comment.