mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 08:08:02 +01:00
Add AccountDatabaseCrawler.dedicatedDynamoMigrationCrawler
This commit is contained in:
@@ -552,6 +552,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
||||
config.getDynamoDbMigrationCrawlerConfiguration().getChunkIntervalMs(),
|
||||
accountsCrawlerChunkPreReadExecutor,
|
||||
dynamicConfigurationManager);
|
||||
accountDynamoDbMigrationCrawler.setDedicatedDynamoMigrationCrawler(true);
|
||||
|
||||
DeletedAccountsTableCrawler deletedAccountsTableCrawler = new DeletedAccountsTableCrawler(deletedAccountsManager, deletedAccountsDirectoryReconcilers, cacheCluster, recurringJobExecutor);
|
||||
MigrationRetryAccountsTableCrawler migrationRetryAccountsTableCrawler = new MigrationRetryAccountsTableCrawler(
|
||||
|
||||
@@ -48,6 +48,9 @@ public class AccountDatabaseCrawler implements Managed, Runnable {
|
||||
private AtomicBoolean running = new AtomicBoolean(false);
|
||||
private boolean finished;
|
||||
|
||||
// temporary to control behavior during the Postgres → Dynamo transition
|
||||
private boolean dedicatedDynamoMigrationCrawler;
|
||||
|
||||
public AccountDatabaseCrawler(AccountsManager accounts,
|
||||
AccountDatabaseCrawlerCache cache,
|
||||
List<AccountDatabaseCrawlerListener> listeners,
|
||||
@@ -128,7 +131,7 @@ public class AccountDatabaseCrawler implements Managed, Runnable {
|
||||
|
||||
try (Timer.Context timer = processChunkTimer.time()) {
|
||||
|
||||
final boolean useDynamo = dynamicConfigurationManager.getConfiguration()
|
||||
final boolean useDynamo = !dedicatedDynamoMigrationCrawler && dynamicConfigurationManager.getConfiguration()
|
||||
.getAccountsDynamoDbMigrationConfiguration()
|
||||
.isDynamoCrawlerEnabled();
|
||||
|
||||
@@ -212,6 +215,10 @@ public class AccountDatabaseCrawler implements Managed, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void setDedicatedDynamoMigrationCrawler(final boolean dedicatedDynamoMigrationCrawler) {
|
||||
this.dedicatedDynamoMigrationCrawler = dedicatedDynamoMigrationCrawler;
|
||||
}
|
||||
|
||||
private synchronized void sleepWhileRunning(long delayMs) {
|
||||
if (running.get()) Util.wait(this, delayMs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user