Fix CDS writer to use AccountsManager.

This commit is contained in:
Graeme Connell
2021-09-10 11:29:29 -06:00
committed by gram-signal
parent bd40e32f3b
commit a064b25a14
3 changed files with 6 additions and 4 deletions

View File

@@ -491,7 +491,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
directoryServerConfiguration.getReplicationName(), directoryReconciliationClient);
deletedAccountsDirectoryReconcilers.add(deletedAccountsDirectoryReconciler);
}
accountDatabaseCrawlerListeners.add(new ContactDiscoveryWriter(accounts));
accountDatabaseCrawlerListeners.add(new ContactDiscoveryWriter(accountsManager));
// PushFeedbackProcessor may update device properties
accountDatabaseCrawlerListeners.add(new PushFeedbackProcessor(accountsManager));
// delete accounts last

View File

@@ -6,9 +6,9 @@ import java.util.UUID;
public class ContactDiscoveryWriter extends AccountDatabaseCrawlerListener {
private final AccountStore accounts;
private final AccountsManager accounts;
public ContactDiscoveryWriter(final AccountStore accounts) {
public ContactDiscoveryWriter(final AccountsManager accounts) {
this.accounts = accounts;
}
@@ -30,7 +30,7 @@ public class ContactDiscoveryWriter extends AccountDatabaseCrawlerListener {
// Its less than ideal, but crawler listeners currently must not call update()
// with the accounts from the chunk, because updates cause the account instance to become stale. Instead, they
// must get a new copy, which they are free to update.
accounts.get(account.getUuid()).ifPresent(accounts::update);
accounts.get(account.getUuid()).ifPresent(a -> accounts.update(a, updated -> {}));
}
}
}