This controls the retry logic.