X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneInserter.java;h=2c0a25270c5634e6a780397146a335d36fa5de62;hb=bd05cecc1f894778248305054800a8a9e2c63969;hp=4bb4868074a7cdecdb39bc803cade9b5abfc1334;hpb=92f9a141ed1d027d68a49029fc7cc5e249ad98dd;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 4bb4868..2c0a252 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); } } @@ -128,7 +128,7 @@ public class SoneInserter extends AbstractService { boolean success = false; try { core.setSoneStatus(sone, SoneStatus.inserting); - FreenetURI finalUri = freenetInterface.insertDirectory(insertInformation.getInsertUri().setKeyType("USK").setDocName("Sone-" + sone.getName()).setSuggestedEdition(0), insertInformation.generateManifestEntries(), "index.html"); + FreenetURI finalUri = freenetInterface.insertDirectory(insertInformation.getInsertUri().setKeyType("USK").setSuggestedEdition(0), insertInformation.generateManifestEntries(), "index.html"); sone.updateUris(finalUri); success = true; logger.log(Level.INFO, "Inserted Sone “%s” at %s.", new Object[] { sone.getName(), finalUri }); @@ -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; } } }