Save database later.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 12 Oct 2011 19:41:22 +0000 (21:41 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 30 May 2012 07:42:38 +0000 (09:42 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java

index 13dfead..a574a59 100644 (file)
@@ -831,7 +831,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                sone.setLatestEdition(Numbers.safeParseLong(ownIdentity.getProperty("Sone.LatestEdition"), (long) 0));
                sone.setClient(new Client("Sone", SonePlugin.VERSION.toString()));
                sone.setKnown(true);
-               database.saveSone(sone);
                /* TODO - load posts ’n stuff */
                final SoneInserter soneInserter = new SoneInserter(this, freenetInterface, sone);
                soneInserter.addSoneInsertListener(this);
@@ -839,6 +838,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                sone.setStatus(SoneStatus.idle);
                loadSone(sone);
                soneInserter.start();
+               database.saveSone(sone);
                return sone;
        }
 
@@ -899,7 +899,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                                }
                        }
                }
-               database.saveSone(sone);
                soneDownloader.addSone(sone);
                soneDownloaders.execute(new Runnable() {
 
@@ -910,6 +909,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        }
 
                });
+               database.saveSone(sone);
                return sone;
        }