From: David ‘Bombe’ Roden Date: Thu, 18 Dec 2014 20:21:04 +0000 (+0100) Subject: Set update time before creating Sone. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=refs%2Fheads%2Fsomewhat-broken;p=Sone.git Set update time before creating Sone. --- diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java index 561f14f..485c452 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java @@ -198,6 +198,12 @@ public class MemoryDatabase extends AbstractService implements Database { } private void loadElements(SoneBuilder soneBuilder, String soneId) { + long soneTime = configurationLoader.getLocalSoneTime(soneId); + if (soneTime == -1) { + return; + } + soneBuilder.lastUpdated(soneTime); + ConfigurationSoneParser configurationSoneParser = new ConfigurationSoneParser(configuration, soneId); try { @@ -224,11 +230,6 @@ public class MemoryDatabase extends AbstractService implements Database { } private void loadSone(LocalSone sone) { - long soneTime = configurationLoader.getLocalSoneTime(sone.getId()); - if (soneTime == -1) { - return; - } - /* load profile. */ ConfigurationSoneParser configurationSoneParser = new ConfigurationSoneParser(configuration, sone.getId()); Profile profile = configurationSoneParser.parseProfile(sone); @@ -286,7 +287,7 @@ public class MemoryDatabase extends AbstractService implements Database { /* if we’re still here, Sone was loaded successfully. */ lock.writeLock().lock(); try { - updateSoneTime(sone, soneTime); + updateSoneTime(sone, sone.getTime()); sone.setProfile(profile); sone.setLikePostIds(likedPostIds); sone.setLikeReplyIds(likedReplyIds);