optimize the retry process