take a block which can be called before the retry