From c05aa3cf55c66a3e79ae9d14bfc4b568650cca64 Mon Sep 17 00:00:00 2001 From: Ghost_chu Date: Sat, 20 Jul 2024 22:20:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Torrent=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=EF=BC=88=E5=A6=82=E6=9E=9C=E5=8F=AF=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/dao/impl/TorrentDao.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TorrentDao.java b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TorrentDao.java index 4519b9a11e..d78b03fa6b 100644 --- a/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TorrentDao.java +++ b/src/main/java/com/ghostchu/peerbanhelper/database/dao/impl/TorrentDao.java @@ -8,6 +8,7 @@ import java.sql.SQLException; import java.util.List; +import java.util.Objects; @Component public class TorrentDao extends AbstractPBHDao { @@ -23,6 +24,19 @@ public synchronized TorrentEntity createIfNotExists(TorrentEntity data) throws S data.setId(id); return data; } - return list.getFirst(); + TorrentEntity entity = list.getFirst(); + boolean anyUpdated = false; + if (!entity.getName().equals(data.getName())) { + entity.setName(data.getName()); + anyUpdated = true; + } + if (!(Objects.equals(entity.getSize(), data.getSize()))) { + entity.setSize(data.getSize()); + anyUpdated = true; + } + if (anyUpdated) { + update(entity); + } + return entity; } } From f76b5dfe2163a39e6e6a563ac5256e87e35d8d1b Mon Sep 17 00:00:00 2001 From: Ghost_chu Date: Sun, 21 Jul 2024 03:19:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBTN=E5=B0=81=E7=A6=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=BC=93=E5=AD=98=E7=9A=84=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E6=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ghostchu/peerbanhelper/btn/ability/BtnAbilitySubmitBans.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/ghostchu/peerbanhelper/btn/ability/BtnAbilitySubmitBans.java b/src/main/java/com/ghostchu/peerbanhelper/btn/ability/BtnAbilitySubmitBans.java index 875205d7f1..82e3a362dd 100644 --- a/src/main/java/com/ghostchu/peerbanhelper/btn/ability/BtnAbilitySubmitBans.java +++ b/src/main/java/com/ghostchu/peerbanhelper/btn/ability/BtnAbilitySubmitBans.java @@ -77,6 +77,7 @@ private void submit() { } else { log.info(tlUI(Lang.BTN_SUBMITTED_BANS, btnPeers.size())); lastReport = System.currentTimeMillis(); + bans.clear(); } }) .exceptionally(e -> { From 73c0fdf91eaf09c0ff3d0121599de6ccefb7fb75 Mon Sep 17 00:00:00 2001 From: Ghost_chu Date: Sun, 21 Jul 2024 03:19:36 +0800 Subject: [PATCH 3/3] bump version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ccfa368ff3..6d67c5e67d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.ghostchu.peerbanhelper peerbanhelper - 5.0.4 + 5.0.5 takari-jar PeerBanHelper