| 197 | } |
| 198 | |
| 199 | static bool download_with_retry(const std::string& url, const std::string& local_path, bool is_lfs, std::string remote_oid, |
| 200 | std::function<void(double)> progress_cb, int max_retries = 3) { |
| 201 | int attempt = 0; |
| 202 | while (attempt < max_retries) { |
| 203 | if (download_file(url, local_path, is_lfs, remote_oid, progress_cb)) { |
| 204 | return true; |
| 205 | } |
| 206 | header_print("FLM", "Download failed (attempt " << (attempt + 1) << "/" << max_retries << ")"); |
| 207 | if(attempt < max_retries - 1) |
| 208 | header_print("FLM", "Retrying..."); |
| 209 | attempt++; |
| 210 | std::this_thread::sleep_for(std::chrono::seconds(1)); |
| 211 | } |
| 212 | |
| 213 | return false; |
| 214 | } |
| 215 | |
| 216 | /// \brief Download content from URL to a string |
| 217 | /// \param url the URL to download from |
no test coverage detected