lib/repo-pull: Support retries for delta superblocks

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 <withnall@endlessm.com>

Closes: #1600
Approved by: jlebon
This commit is contained in:
Philip Withnall 2018-05-28 17:06:46 +01:00 committed by Atomic Bot
parent f342e66c11
commit bf1af263d6
1 changed files with 6 additions and 2 deletions

View File

@ -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));
}