Allow migration thread pool to be scaled up

This commit is contained in:
Chris Eager 2021-04-21 15:10:38 -05:00 committed by Chris Eager
parent be6d6351b9
commit b75456acf3
1 changed files with 7 additions and 2 deletions

View File

@ -260,8 +260,13 @@ public class AccountsDynamoDb extends AbstractDynamoDbStore implements AccountSt
public CompletableFuture<Void> migrate(List<Account> accounts, int threads) {
migrationThreadPool.setCorePoolSize(threads);
migrationThreadPool.setMaximumPoolSize(threads);
if (threads > migrationThreadPool.getMaximumPoolSize()) {
migrationThreadPool.setMaximumPoolSize(threads);
migrationThreadPool.setCorePoolSize(threads);
} else {
migrationThreadPool.setCorePoolSize(threads);
migrationThreadPool.setMaximumPoolSize(threads);
}
final List<CompletableFuture<?>> futures = accounts.stream()
.map(this::migrate)