From 6e08990d7764f321237a896f55c517c9cbd98815 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 24 Oct 2010 00:45:07 +0200 Subject: [PATCH] Fix insertion logic. --- src/main/java/net/pterodactylus/sone/core/SoneInserter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; } } } -- 2.7.4