Set `consistentRead=true` for registration recovery password lookup
This avoids a race condition (in integration test situations) where a lookup could return no results
This commit is contained in:
parent
62e02a49df
commit
5ced86af1d
|
@ -67,7 +67,7 @@ public interface RateLimiter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the wrapped {@code validate()} call throws a {@link RateLimitExceededException}, it will adapt it to ensure that
|
* If the wrapped {@code validate()} call throws a {@link RateLimitExceededException}, it will adapt it to ensure that
|
||||||
* {@link RateLimitExceededException#isLegacy()} returns {@code true}
|
* {@link RateLimitExceededException#isLegacy()} returns {@code false}
|
||||||
*/
|
*/
|
||||||
static void adaptLegacyException(final RateLimitValidator validator) throws RateLimitExceededException {
|
static void adaptLegacyException(final RateLimitValidator validator) throws RateLimitExceededException {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -60,9 +60,9 @@ public class RegistrationRecoveryPasswords extends AbstractDynamoDbStore {
|
||||||
|
|
||||||
public CompletableFuture<Optional<SaltedTokenHash>> lookup(final String number) {
|
public CompletableFuture<Optional<SaltedTokenHash>> lookup(final String number) {
|
||||||
return asyncClient.getItem(GetItemRequest.builder()
|
return asyncClient.getItem(GetItemRequest.builder()
|
||||||
.tableName(tableName)
|
.tableName(tableName)
|
||||||
.key(Map.of(
|
.key(Map.of(KEY_E164, AttributeValues.fromString(number)))
|
||||||
KEY_E164, AttributeValues.fromString(number)))
|
.consistentRead(true)
|
||||||
.build())
|
.build())
|
||||||
.thenApply(getItemResponse -> {
|
.thenApply(getItemResponse -> {
|
||||||
final Map<String, AttributeValue> item = getItemResponse.item();
|
final Map<String, AttributeValue> item = getItemResponse.item();
|
||||||
|
|
Loading…
Reference in New Issue