From 9ba03848f28dea638e354887489a1d868a6ca08e Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Tue, 7 Feb 2023 16:53:44 +0900 Subject: [PATCH] Small perf improvement when fetching exactly 1 payout by id --- .../HostedServices/PullPaymentHostedService.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/HostedServices/PullPaymentHostedService.cs b/BTCPayServer/HostedServices/PullPaymentHostedService.cs index d7e0d2648..b4a22a596 100644 --- a/BTCPayServer/HostedServices/PullPaymentHostedService.cs +++ b/BTCPayServer/HostedServices/PullPaymentHostedService.cs @@ -178,7 +178,15 @@ namespace BTCPayServer.HostedServices if (payoutQuery.PayoutIds is not null) { - query = query.Where(data => payoutQuery.PayoutIds.Contains(data.Id)); + if (payoutQuery.PayoutIds.Length == 1) + { + var payoutId = payoutQuery.PayoutIds[0]; + query = query.Where(data => data.Id == payoutId); + } + else + { + query = query.Where(data => payoutQuery.PayoutIds.Contains(data.Id)); + } } if (payoutQuery.PaymentMethods is not null)