From 50cca938f17fed2df8262c9bebc9ebe1712d8da5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 18 Dec 2014 21:21:04 +0100 Subject: [PATCH] Set update time before creating Sone. --- .../pterodactylus/sone/database/memory/MemoryDatabase.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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); -- 2.7.4