Add warning log for duplicate key violations in SaveMatchAsync

When a match result is inserted concurrently between the existence check and the
database insert, log a warning to help with diagnostics while gracefully handling
the idempotent duplicate key violation.
This commit is contained in:
2026-06-01 16:16:54 +03:00
parent 87de7d3f77
commit 070aa329fe
@@ -68,6 +68,10 @@ public sealed class EfMatcherRepository : IMatcherRepository
{
// Duplicate key violation: record was inserted between the AnyAsync check and SaveChangesAsync.
// This is safe to ignore — the match result already exists in the database.
_logger.LogWarning(
"Duplicate match result ignored: CV={CvDocumentId} Job={JobDocumentId} Language={Language}. " +
"Record was likely inserted concurrently. This is expected behavior in high-concurrency scenarios.",
cvDocumentId, jobDocumentId, language);
}
}