mirror of
https://github.com/Qortal/qortal.git
synced 2025-06-07 16:56:59 +00:00
Yet another attempt to optimize the online accounts import queue processing.
The main difference here is that we now remove items from the onlineAccountsImportQueue in a batch, _after_ they have been imported. This prevents duplicates from being added to the queue in the previous time gap between them being removed and imported.
This commit is contained in:
parent
5989473c8a
commit
765416db71
@ -207,13 +207,20 @@ public class OnlineAccountsManager {
|
|||||||
|
|
||||||
boolean isValid = this.isValidCurrentAccount(repository, onlineAccountData);
|
boolean isValid = this.isValidCurrentAccount(repository, onlineAccountData);
|
||||||
if (isValid)
|
if (isValid)
|
||||||
addAccounts(Arrays.asList(onlineAccountData));
|
onlineAccountsToAdd.add(onlineAccountData);
|
||||||
|
|
||||||
// Remove from queue
|
// Don't remove from the queue yet - we'll do this at the end of the process
|
||||||
onlineAccountsImportQueue.remove(onlineAccountData);
|
// This prevents duplicates being added to the queue whilst it's being processed
|
||||||
}
|
}
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
LOGGER.error("Repository issue while verifying online accounts", e);
|
LOGGER.error("Repository issue while verifying online accounts", e);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (!onlineAccountsToAdd.isEmpty()) {
|
||||||
|
LOGGER.debug("Merging {} validated online accounts from import queue", onlineAccountsToAdd.size());
|
||||||
|
addAccounts(onlineAccountsToAdd);
|
||||||
|
onlineAccountsImportQueue.removeAll(onlineAccountsToAdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user