From dca5f8919352273c14fdda7f9d61265e02d05dab Mon Sep 17 00:00:00 2001 From: Brit Myers Date: Tue, 23 Jul 2024 17:27:03 -0400 Subject: [PATCH] fix(dal): Don't keep looping through past hashes if you find an existing schema when importing a pkg --- lib/dal/src/pkg/import.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/dal/src/pkg/import.rs b/lib/dal/src/pkg/import.rs index 34671bc3ea..44e2d112c9 100644 --- a/lib/dal/src/pkg/import.rs +++ b/lib/dal/src/pkg/import.rs @@ -465,13 +465,17 @@ async fn import_schema( // find if there's an existing module // if there is, find the asssociated schemas if let Some(found) = Module::find_by_root_hash(ctx, past_hash).await? { - existing_schema = - found.list_associated_schemas(ctx).await?.into_iter().next(); + match found.list_associated_schemas(ctx).await?.into_iter().next() { + Some(existing) => { + existing_schema = Some(existing); + break; + } + None => continue, + } } } } } - let data = schema_spec .data() .ok_or(PkgError::DataNotFound("schema".into()))?;