fix: bundled package regression causing it to disable and not update (#967)
This commit is contained in:
parent
a976a66c8b
commit
51cb12c964
2 changed files with 38 additions and 9 deletions
|
|
@ -63,6 +63,23 @@ pub async fn taken_bundle_names(
|
|||
.collect())
|
||||
}
|
||||
|
||||
pub(crate) async fn overrides_outside_declined(
|
||||
cluster_id: i64,
|
||||
archives: &[BundleArchive],
|
||||
mut overrides: Vec<oneclient_db::models::ClusterBundleOverrideRow>,
|
||||
ctx: &ContentCtx,
|
||||
) -> ContentResult<Vec<oneclient_db::models::ClusterBundleOverrideRow>> {
|
||||
let taken = taken_bundle_names(cluster_id, archives, ctx).await?;
|
||||
let declined: std::collections::HashSet<&str> = archives
|
||||
.iter()
|
||||
.map(|archive| archive.manifest.name.as_str())
|
||||
.filter(|name| !taken.contains(*name))
|
||||
.collect();
|
||||
|
||||
overrides.retain(|o| !declined.contains(o.bundle_name.as_str()));
|
||||
Ok(overrides)
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip(bundles, ctx))]
|
||||
pub async fn pending_bundle_choices(
|
||||
cluster_id: i64,
|
||||
|
|
@ -470,7 +487,13 @@ pub async fn heal_bundle_activity(
|
|||
}
|
||||
}
|
||||
|
||||
let overrides = bundle_dao::list_overrides(&ctx.db, cluster_id).await?;
|
||||
let overrides = overrides_outside_declined(
|
||||
cluster_id,
|
||||
archives,
|
||||
bundle_dao::list_overrides(&ctx.db, cluster_id).await?,
|
||||
ctx,
|
||||
)
|
||||
.await?;
|
||||
|
||||
let mut live_packages: std::collections::HashSet<String> = tracked
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ use futures_util::StreamExt;
|
|||
use crate::bundles::install::{
|
||||
BUNDLE_INSTALL_CONCURRENCY, accepted_bundles, bundle_cluster, decline_unasked_skyblock,
|
||||
disable_was_deliberate, external_ids_by_sha1, find_override, find_user_suppression,
|
||||
heal_bundle_activity, install_package_from_bundle, remove_artifact_from_cluster,
|
||||
set_artifact_enabled_to, takes_bundle,
|
||||
heal_bundle_activity, install_package_from_bundle, overrides_outside_declined,
|
||||
remove_artifact_from_cluster, set_artifact_enabled_to, takes_bundle,
|
||||
};
|
||||
use crate::bundles::manager::BundlesManager;
|
||||
use crate::bundles::overrides;
|
||||
|
|
@ -481,17 +481,23 @@ pub async fn apply_bundle_updates_with(
|
|||
// Must run first
|
||||
// the check below never consults `enabled` so unrecorded disables would
|
||||
// read as healthy and be left untouched
|
||||
{
|
||||
let archives = {
|
||||
let cluster = PackageStore::get_cluster(cluster_id, ctx).await?;
|
||||
let loader = GameLoader::from_repr(cluster.mc_loader as u8).unwrap_or(GameLoader::Fabric);
|
||||
if let Ok(archives) = bundles.archives_for(ctx, &cluster.mc_version, loader).await {
|
||||
heal_bundle_activity(cluster_id, &archives, ctx).await?;
|
||||
decline_unasked_skyblock(&cluster, &archives, ctx).await?;
|
||||
}
|
||||
let archives = bundles.archives_for(ctx, &cluster.mc_version, loader).await;
|
||||
if let Ok(archives) = &archives {
|
||||
heal_bundle_activity(cluster_id, archives, ctx).await?;
|
||||
decline_unasked_skyblock(&cluster, archives, ctx).await?;
|
||||
}
|
||||
archives
|
||||
};
|
||||
|
||||
let overrides = bundle_dao::list_overrides(&ctx.db, cluster_id).await?;
|
||||
let check = check_bundle_updates_inner(cluster_id, bundles, ctx, &overrides).await?;
|
||||
let suppressing = match &archives {
|
||||
Ok(archives) => overrides_outside_declined(cluster_id, archives, overrides, ctx).await?,
|
||||
Err(_) => overrides,
|
||||
};
|
||||
|
||||
tracing::info!(
|
||||
cluster_id,
|
||||
|
|
@ -535,7 +541,7 @@ pub async fn apply_bundle_updates_with(
|
|||
s.expect(oneclient_events::TaskCategory::Packages, count, bytes);
|
||||
}
|
||||
|
||||
let overrides_ref = &overrides;
|
||||
let overrides_ref = &suppressing;
|
||||
let fetched_updates = futures_util::stream::iter(check.updates_available.into_iter().map(
|
||||
|update| async move {
|
||||
if past(deadline) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue