Skip to content

Commit dd21877

Browse files
tareknaservincenzopalazzo
authored andcommitted
fix(coffee): only upgrade plugins if needed
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]>
1 parent 1b0a9bf commit dd21877

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

coffee_core/src/coffee.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,18 @@ impl PluginManager for CoffeeManager {
352352
.ok_or_else(|| error!("Repository with name: `{}` not found", repo))?;
353353

354354
let status = repository.upgrade(&self.config.plugins, verbose).await?;
355-
for plugins in status.plugins_effected.iter() {
356-
self.remove(plugins).await?;
357-
self.install(plugins, verbose, false).await?;
355+
356+
// if status is not up to date, we need to update the plugins as well
357+
match status.status {
358+
UpgradeStatus::Updated(_, _) => {
359+
for plugins in status.plugins_effected.iter() {
360+
self.remove(plugins).await?;
361+
self.install(plugins, verbose, false).await?;
362+
}
363+
}
364+
_ => {}
358365
}
366+
359367
self.flush().await?;
360368
Ok(status)
361369
}

0 commit comments

Comments
 (0)