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

This commit is contained in:
Graeme Connell authored and gram-signal committed 2021-09-07 13:41:47 -06:00
1 parent b080a5db4d
commit 2059bb5ef8
2 files changed
+23 -3

No files matched your search

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