Implement retry loop for failed requests