Update test to handle read-then-write in ContactDiscoveryWriter.

This commit is contained in:
Graeme Connell
2021-09-07 11:16:43 -06:00
committed by gram-signal
parent b080a5db4d
commit 2059bb5ef8
2 changed files with 23 additions and 3 deletions

View File

@@ -27,6 +27,9 @@ public class ContactDiscoveryWriter extends AccountDatabaseCrawlerListener {
throws AccountDatabaseCrawlerRestartException {
for (Account account : chunkAccounts) {
if (account.isCanonicallyDiscoverable() != account.shouldBeVisibleInDirectory()) {
// 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);
}
}