MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / download_with_retry

Function download_with_retry

src/pull/download_model.cpp:199–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199static 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

Callers 1

download_multiple_filesFunction · 0.85

Calls 1

download_fileFunction · 0.85

Tested by

no test coverage detected