From f5da4791ada67f5a988bec00746fcde0e27dea00 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 29 Jul 2017 13:50:32 +0200 Subject: [PATCH] avoid unnecessary roster sync in OMEMO code. fixed startup performance regression --- .../eu/siacs/conversations/crypto/axolotl/AxolotlService.java | 2 -- .../eu/siacs/conversations/persistance/DatabaseBackend.java | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index 025c4e592..3798985de 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -218,14 +218,12 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { deviceIds = store.getSubDeviceSessions(address); putDevicesForJid(address, deviceIds, store); } - } @Override public void put(SignalProtocolAddress address, XmppAxolotlSession value) { super.put(address, value); value.setNotFresh(); - xmppConnectionService.syncRosterToDisk(account); //TODO why? } public void put(XmppAxolotlSession session) { diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index 483d62913..8dc9e62ce 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -956,7 +956,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { public List getKnownSignalAddresses(Account account) { List addresses = new ArrayList<>(); - String[] colums = {SQLiteAxolotlStore.NAME}; + String[] colums = {"DISTINCT "+SQLiteAxolotlStore.NAME}; String[] selectionArgs = {account.getUuid()}; Cursor cursor = getReadableDatabase().query(SQLiteAxolotlStore.SESSION_TABLENAME, colums, @@ -965,7 +965,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { null,null,null ); while (cursor.moveToNext()) { - addresses.add(cursor.getString(cursor.getColumnIndex(SQLiteAxolotlStore.NAME))); + addresses.add(cursor.getString(0)); } cursor.close(); return addresses;