Add account to migration retry table on transient dynamo failure

This commit is contained in:
Chris Eager 2021-09-03 14:15:22 -07:00 committed by Chris Eager
parent b91a69d8b3
commit f3b9a8d97f
1 changed files with 15 additions and 8 deletions

View File

@ -214,6 +214,7 @@ public class AccountsDynamoDb extends AbstractDynamoDbStore implements AccountSt
throw new IllegalArgumentException(e);
}
try {
try {
UpdateItemResponse response = client.updateItem(updateItemRequest);
@ -228,6 +229,12 @@ public class AccountsDynamoDb extends AbstractDynamoDbStore implements AccountSt
// but we can infer it was an optimistic locking failure if the UUID is known
throw get(account.getUuid()).isPresent() ? new ContestedOptimisticLockException() : e;
}
} catch (final Exception e) {
// the Dynamo account now lags the Postgres account version. Put it in the migration retry table so that it will
// get updated fasterotherwise it will be stale until the accounts crawler runs again
migrationRetryAccounts.put(account.getUuid());
throw e;
}
});
}