From: David ‘Bombe’ Roden Date: Sat, 23 Oct 2010 22:45:07 +0000 (+0200) Subject: Fix insertion logic. X-Git-Tag: 0.1-RC1~45 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6e08990d7764f321237a896f55c517c9cbd98815;p=Sone.git Fix insertion logic. --- diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 4bb4868..c2e0cc6 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -116,9 +116,9 @@ public class SoneInserter extends AbstractService { lastModificationTime = System.currentTimeMillis(); sone.setTime(lastModificationTime); logger.log(Level.FINE, "Sone %s has been modified, waiting 60 seconds before inserting.", new Object[] { sone.getName() }); - if ((System.currentTimeMillis() - lastModificationTime) > (60 * 1000)) { - insertInformation = new InsertInformation(sone); - } + } + if ((lastModificationTime > 0) && ((System.currentTimeMillis() - lastModificationTime) > (60 * 1000))) { + insertInformation = new InsertInformation(sone); } } @@ -148,6 +148,7 @@ public class SoneInserter extends AbstractService { logger.log(Level.FINE, "Sone “%s” was not modified further, resetting counter…", new Object[] { sone }); sone.setModificationCounter(0); modificationCounter = 0; + lastModificationTime = 0; } } }