From 09d44726a44d90e4b776e988d75a89149a5da95d Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 3 Jul 2023 11:41:30 +0300 Subject: [PATCH] New: Speed up API add by reworking AuthorExistsValidator Co-authored-by: Qstick --- src/NzbDrone.Core/Validation/Paths/AuthorExistsValidator.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Validation/Paths/AuthorExistsValidator.cs b/src/NzbDrone.Core/Validation/Paths/AuthorExistsValidator.cs index 6f28ff199..d7d7bbc07 100644 --- a/src/NzbDrone.Core/Validation/Paths/AuthorExistsValidator.cs +++ b/src/NzbDrone.Core/Validation/Paths/AuthorExistsValidator.cs @@ -21,7 +21,9 @@ protected override bool IsValid(PropertyValidatorContext context) return true; } - return !_authorService.GetAllAuthors().Exists(s => s.Metadata.Value.ForeignAuthorId == context.PropertyValue.ToString()); + var foreignAuthorId = context.PropertyValue.ToString(); + + return _authorService.FindById(foreignAuthorId) == null; } } }