From bf1af263d67c0f7e49355088528f02d78fa68e90 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 28 May 2018 17:06:46 +0100 Subject: [PATCH] lib/repo-pull: Support retries for delta superblocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the recently introduced architecture for retrying network requests on transient failure to do the same for delta superblock requests, now that they’re queued. Signed-off-by: Philip Withnall Closes: #1600 Approved by: jlebon --- src/libostree/ostree-repo-pull.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 7d05c10f..550a33de 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -212,6 +212,7 @@ typedef struct { char *from_revision; char *to_revision; OstreeCollectionRef *requested_ref; /* (nullable) */ + guint n_retries_remaining; } FetchDeltaSuperData; static void @@ -2767,8 +2768,10 @@ on_superblock_fetched (GObject *src, if (local_error == NULL) pull_data->n_fetched_metadata++; - /* FIXME: This should check _ostree_fetcher_should_retry_request(). */ - check_outstanding_requests_handle_error (pull_data, &local_error); + if (_ostree_fetcher_should_retry_request (local_error, fetch_data->n_retries_remaining--)) + enqueue_one_static_delta_superblock_request_s (pull_data, g_steal_pointer (&fetch_data)); + else + check_outstanding_requests_handle_error (pull_data, &local_error); g_clear_pointer (&fetch_data, fetch_delta_super_data_free); } @@ -2822,6 +2825,7 @@ enqueue_one_static_delta_superblock_request (OtPullData *pull_dat fdata->from_revision = g_strdup (from_revision); fdata->to_revision = g_strdup (to_revision); fdata->requested_ref = (ref != NULL) ? ostree_collection_ref_dup (ref) : NULL; + fdata->n_retries_remaining = pull_data->n_network_retries; enqueue_one_static_delta_superblock_request_s (pull_data, g_steal_pointer (&fdata)); }