diff --git a/pom.xml b/pom.xml index fceb8d5a3f..2d5d253ae4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.ghostchu.peerbanhelper peerbanhelper - 6.1.0 + 6.1.1 takari-jar PeerBanHelper diff --git a/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java b/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java index ef273770dd..e6a7ff874f 100644 --- a/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java +++ b/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/ActiveMonitoringModule.java @@ -34,9 +34,6 @@ public class ActiveMonitoringModule extends AbstractFeatureModule implements Rel private final PeerRecordDao peerRecordDao; private final Deque dataBuffer = new ConcurrentLinkedDeque<>(); private final TrafficJournalDao trafficJournalDao; - private ExecutorService taskWriteService; - private long dataRetentionTime; - private ScheduledExecutorService scheduleService; private final BlockingDeque taskWriteQueue = new LinkedBlockingDeque<>(); private final Cache diskWriteCache = CacheBuilder .newBuilder() @@ -44,6 +41,9 @@ public class ActiveMonitoringModule extends AbstractFeatureModule implements Rel .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(); @@ -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); }