Skip to content

Commit 4831ead

Browse files
committed
fix: Skip maintainer updates that conflict
We're using the github_id as a primary key for the NixMaintainer model which prevents us from updating this field for a specific username and we can't have duplicate usernames either since we have a unique contstraint on them. This "patches" #658 so ingestion works, until we figure out how to handle #657.
1 parent 48bcc0d commit 4831ead

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/shared/evaluation.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,23 @@ def ingest_maintainers(
196196
# Duplicate...
197197
if m.github_id in seen:
198198
continue
199-
200-
ms.append(
201-
NixMaintainer.objects.update_or_create(
202-
defaults={
203-
"github": m.github,
204-
"email": m.email,
205-
"matrix": m.matrix,
206-
"name": m.name,
207-
},
208-
github_id=m.github_id,
199+
try:
200+
ms.append(
201+
NixMaintainer.objects.update_or_create(
202+
defaults={
203+
"github": m.github,
204+
"email": m.email,
205+
"matrix": m.matrix,
206+
"name": m.name,
207+
},
208+
github_id=m.github_id,
209+
)
209210
)
210-
)
211+
except IntegrityError:
212+
# Skip this maintainer until we decide how to handle #657
213+
logger.debug(f"Skipping maintainer {m.github} due to username conflict")
214+
continue
215+
211216
seen.add(m.github_id)
212217

213218
return [obj for obj, _ in ms]

0 commit comments

Comments
 (0)