Retry registration recovery password migration attempts
This commit is contained in:
		
							parent
							
								
									1d9734c824
								
							
						
					
					
						commit
						27f5f94c60
					
				| 
						 | 
					@ -18,6 +18,8 @@ import org.whispersystems.textsecuregcm.auth.SaltedTokenHash;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
 | 
					import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.storage.RegistrationRecoveryPasswordsManager;
 | 
					import org.whispersystems.textsecuregcm.storage.RegistrationRecoveryPasswordsManager;
 | 
				
			||||||
import reactor.core.publisher.Mono;
 | 
					import reactor.core.publisher.Mono;
 | 
				
			||||||
 | 
					import reactor.util.retry.Retry;
 | 
				
			||||||
 | 
					import java.time.Duration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class MigrateRegistrationRecoveryPasswordsCommand extends AbstractCommandWithDependencies {
 | 
					public class MigrateRegistrationRecoveryPasswordsCommand extends AbstractCommandWithDependencies {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,6 +91,7 @@ public class MigrateRegistrationRecoveryPasswordsCommand extends AbstractCommand
 | 
				
			||||||
          return dryRun
 | 
					          return dryRun
 | 
				
			||||||
              ? Mono.just(false)
 | 
					              ? Mono.just(false)
 | 
				
			||||||
              : Mono.fromFuture(() -> registrationRecoveryPasswordsManager.migrateE164Record(e164, saltedTokenHash, expiration))
 | 
					              : Mono.fromFuture(() -> registrationRecoveryPasswordsManager.migrateE164Record(e164, saltedTokenHash, expiration))
 | 
				
			||||||
 | 
					                  .retryWhen(Retry.backoff(3, Duration.ofSeconds(1)))
 | 
				
			||||||
                  .onErrorResume(throwable -> {
 | 
					                  .onErrorResume(throwable -> {
 | 
				
			||||||
                        logger.warn("Failed to migrate record for {}", e164, throwable);
 | 
					                        logger.warn("Failed to migrate record for {}", e164, throwable);
 | 
				
			||||||
                        return Mono.empty();
 | 
					                        return Mono.empty();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue