Set update time before creating Sone. somewhat-broken
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 18 Dec 2014 20:21:04 +0000 (21:21 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 18 Dec 2014 20:21:04 +0000 (21:21 +0100)
src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java

index 561f14f..485c452 100644 (file)
@@ -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);