Pass message IDs to cleanup hooks in batches.

This commit is contained in:
akwizgran
2021-02-26 12:49:35 +00:00
committed by Torsten Grote
parent 43b437af92
commit 4bd8ee8ccf
2 changed files with 9 additions and 11 deletions

View File

@@ -137,6 +137,7 @@ class CleanupManagerImpl implements CleanupManager, Service, EventListener {
if (LOG.isLoggable(INFO)) {
LOG.info(messageIds.size() + " messages to delete");
}
for (MessageId m : messageIds) db.stopCleanupTimer(txn, m);
Group group = db.getGroup(txn, groupId);
ClientMajorVersion cv = new ClientMajorVersion(group.getClientId(),
group.getMajorVersion());
@@ -144,10 +145,7 @@ class CleanupManagerImpl implements CleanupManager, Service, EventListener {
if (hook == null) {
throw new IllegalStateException("No cleanup hook for " + cv);
}
for (MessageId m : messageIds) {
hook.deleteMessage(txn, groupId, m);
db.stopCleanupTimer(txn, m);
}
hook.deleteMessages(txn, groupId, messageIds);
txn.attach(new MessagesCleanedUpEvent(groupId, messageIds));
}
}