Revert "Store Sone earlier when creating new Sone"
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 19 Jul 2015 18:38:35 +0000 (20:38 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 19 Jul 2015 18:38:35 +0000 (20:38 +0200)
This reverts commit b64a9dcfdd584c6c6b7da45066b27bcc17cf6942.

src/main/java/net/pterodactylus/sone/core/Core.java

index 95b4bfe..73bb95f 100644 (file)
@@ -645,14 +645,13 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                sone.setLatestEdition(fromNullable(tryParse(property)).or(0L));
                sone.setClient(new Client("Sone", SonePlugin.VERSION.toString()));
                sone.setKnown(true);
-               loadSone(sone);
-               sone.setStatus(SoneStatus.idle);
-               database.storeSone(sone);
                SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, ownIdentity.getId());
                eventBus.register(soneInserter);
                synchronized (soneInserters) {
                        soneInserters.put(sone, soneInserter);
                }
+               loadSone(sone);
+               sone.setStatus(SoneStatus.idle);
                soneInserter.start();
                return sone;
        }
@@ -1086,6 +1085,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                        for (Album album : topLevelAlbums) {
                                sone.getRootAlbum().addAlbum(album);
                        }
+                       database.storeSone(sone);
                        synchronized (soneInserters) {
                                soneInserters.get(sone).setLastInsertFingerprint(lastInsertFingerprint);
                        }