From dcc4b6e80795223a161d66abab44d2ca40a94140 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Sun, 25 Sep 2022 22:19:37 +0100 Subject: [PATCH] Use and query for where clause. --- src/main/java/me/kavin/piped/utils/ResponseHelper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index 7c34001..f0be209 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -1072,8 +1072,10 @@ public class ResponseHelper { var root = cu.getRoot(); cu .set(root.get("subscribedAt"), System.currentTimeMillis()) - .where(cb.lt(root.get("subscribedAt"), System.currentTimeMillis() - (TimeUnit.DAYS.toMillis(Constants.SUBSCRIPTIONS_EXPIRY) / 2))) - .where(root.get("id").in(channelIds)); + .where(cb.and( + root.get("id").in(channelIds), + cb.lt(root.get("subscribedAt"), System.currentTimeMillis() - (TimeUnit.DAYS.toMillis(Constants.SUBSCRIPTIONS_EXPIRY) / 2)) + )); s.createMutationQuery(cu).executeUpdate(); tr.commit(); } catch (Exception e) {