loottracker: Run database related code in the subscription (#1780)

This commit is contained in:
Owain van Brakel
2019-10-14 11:18:31 +02:00
committed by Kyle
parent 4b592bfb99
commit 9e8f165601

View File

@@ -352,7 +352,6 @@ public class LootTrackerPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
Completable.fromAction(this::initDatabase).subscribeOn(Schedulers.io()).subscribe();
addSubscriptions();
ignoredItems = Text.fromCSV(config.getIgnoredItems());
@@ -372,10 +371,13 @@ public class LootTrackerPlugin extends Plugin
clientToolbar.addNavigation(navButton);
Completable.fromAction(this::initDatabase)
.subscribeOn(Schedulers.io())
.subscribe(() ->
{
AccountSession accountSession = sessionManager.getAccountSession();
if (accountSession != null || this.localPersistence)
{
clientThread.invokeLater(() ->
{
switch (client.getGameState())
@@ -472,6 +474,7 @@ public class LootTrackerPlugin extends Plugin
return true;
});
}
});
}
@Override