add retry and timeout for afn.