Skip to content

Commit

Permalink
Merge pull request #439 from PBH-BTN/master
Browse files Browse the repository at this point in the history
v6.1.1
  • Loading branch information
Ghost-chu authored Sep 8, 2024
2 parents 140cf3f + fb8e66a commit f847d40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 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>6.1.0</version>
<version>6.1.1</version>
<packaging>takari-jar</packaging>

<name>PeerBanHelper</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public class ActiveMonitoringModule extends AbstractFeatureModule implements Rel
private final PeerRecordDao peerRecordDao;
private final Deque<PeerRecordDao.BatchHandleTasks> dataBuffer = new ConcurrentLinkedDeque<>();
private final TrafficJournalDao trafficJournalDao;
private ExecutorService taskWriteService;
private long dataRetentionTime;
private ScheduledExecutorService scheduleService;
private final BlockingDeque<Runnable> taskWriteQueue = new LinkedBlockingDeque<>();
private final Cache<PeerRecordDao.BatchHandleTasks, Object> diskWriteCache = CacheBuilder
.newBuilder()
.expireAfterWrite(3, TimeUnit.MINUTES)
.maximumSize(3500)
.removalListener(notification -> dataBuffer.offer((PeerRecordDao.BatchHandleTasks) notification.getKey()))
.build();
private ExecutorService taskWriteService;
private long dataRetentionTime;
private ScheduledExecutorService scheduleService;

public ActiveMonitoringModule(PeerRecordDao peerRecordDao, TrafficJournalDao trafficJournalDao) {
super();
Expand Down Expand Up @@ -123,10 +123,12 @@ private void writeJournal() {
for (Downloader downloader : getServer().getDownloaders()) {
try {
var entity = trafficJournalDao.getTodayJournal(downloader.getName());
var stats = downloader.getStatistics();
entity.setDataOverallUploaded(stats.totalUploaded());
entity.setDataOverallDownloaded(stats.totalDownloaded());
trafficJournalDao.update(entity);
if (downloader.login().success()) {
var stats = downloader.getStatistics();
entity.setDataOverallUploaded(stats.totalUploaded());
entity.setDataOverallDownloaded(stats.totalDownloaded());
trafficJournalDao.update(entity);
}
} catch (Throwable e) {
log.error("Unable to write hourly traffic journal to database", e);
}
Expand Down

0 comments on commit f847d40

Please sign in to comment.