Skip to content

Commit 10adda6

Browse files
committed
refactor: simplify repo affiliation registry retrival
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent dcb5657 commit 10adda6

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

services/apps/git_integration/src/crowdgit/database/crud.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,17 +529,15 @@ async def save_service_execution(service_execution: ServiceExecution) -> None:
529529

530530
async def get_repo_affiliation_registry(repo_id: str) -> RepoAffiliationRegistry | None:
531531
sql_query = """
532-
SELECT "filePath", "fileHash", "status", "snapshot", "lastRunAt"
532+
SELECT "repoId", "filePath", "fileHash", "status", "snapshot", "lastRunAt"
533533
FROM git."repoAffiliationRegistry"
534534
WHERE "repoId" = $1
535535
"""
536536
result = await fetchrow(sql_query, (repo_id,))
537537
if not result:
538538
return None
539539

540-
row = dict(result)
541-
row["repoId"] = repo_id
542-
return RepoAffiliationRegistry.from_db(row)
540+
return RepoAffiliationRegistry.from_db(dict(result))
543541

544542

545543
async def upsert_repo_affiliation_registry(registry: RepoAffiliationRegistry) -> None:

services/apps/git_integration/src/crowdgit/services/affiliation/affiliation_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,9 @@ async def resolve_snapshot(
543543
needs_parse = file_hash != stored_hash or existing_snapshot is None
544544

545545
if not needs_parse:
546-
if not existing_snapshot:
546+
if not existing_snapshot or (
547+
registry and registry.status == AffiliationRegistryStatus.UNUSABLE.value
548+
):
547549
return [], 0.0
548550

549551
applyable = self.normalize_parsed_affiliations(existing_snapshot)

0 commit comments

Comments
 (0)