Skip to content

Commit

Permalink
Merge pull request #270 from PBH-BTN/master
Browse files Browse the repository at this point in the history
v5.0.5
  • Loading branch information
Ghost-chu authored Jul 20, 2024
2 parents ce20485 + 73c0fdf commit 49eaf4b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.ghostchu.peerbanhelper</groupId>
<artifactId>peerbanhelper</artifactId>
<version>5.0.4</version>
<version>5.0.5</version>
<packaging>takari-jar</packaging>

<name>PeerBanHelper</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private void submit() {
} else {
log.info(tlUI(Lang.BTN_SUBMITTED_BANS, btnPeers.size()));
lastReport = System.currentTimeMillis();
bans.clear();
}
})
.exceptionally(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.sql.SQLException;
import java.util.List;
import java.util.Objects;

@Component
public class TorrentDao extends AbstractPBHDao<TorrentEntity, Long> {
Expand All @@ -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;
}
}

0 comments on commit 49eaf4b

Please sign in to comment.