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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user