From 425ccc0a33610c71f0258423c83701dc4e273ee7 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 19 Jan 2017 05:49:23 -0500 Subject: [PATCH] pull: Show Estimating if we're scanning too The libcurl backend does all the work in the main thread/loop, which seems to starve the idle scanning worker more. With the libcurl backend, we're a lot more likely to have at least one outstanding metadata request. But it can more easily transiently happen with libcurl that all of our current fetches are content. To be accurate here, just show Estimating if we're scanning too. Closes: #654 Approved by: jlebon --- src/libostree/ostree-fetcher.c | 4 ++-- src/libostree/ostree-repo-pull.c | 1 + src/libostree/ostree-repo.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c index bc6c14c9..bb98023d 100644 --- a/src/libostree/ostree-fetcher.c +++ b/src/libostree/ostree-fetcher.c @@ -552,11 +552,11 @@ ostree_fetcher_session_thread (gpointer data) /* XXX: Now that we have mirrorlist support, we could make this even smarter * by spreading requests across mirrors. */ g_object_get (closure->session, "max-conns-per-host", &max_conns, NULL); - if (max_conns < 8) + if (max_conns < _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS) { /* We download a lot of small objects in ostree, so this * helps a lot. Also matches what most modern browsers do. */ - max_conns = 8; + max_conns = _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS; g_object_set (closure->session, "max-conns-per-host", max_conns, NULL); diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 21f3007e..79da7809 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -210,6 +210,7 @@ update_progress (gpointer user_data) ostree_async_progress_set_uint (pull_data->progress, "outstanding-writes", outstanding_writes); ostree_async_progress_set_uint (pull_data->progress, "fetched", fetched); ostree_async_progress_set_uint (pull_data->progress, "requested", requested); + ostree_async_progress_set_uint (pull_data->progress, "scanning", g_queue_is_empty (&pull_data->scan_object_queue) ? 0 : 1); ostree_async_progress_set_uint (pull_data->progress, "scanned-metadata", n_scanned_metadata); ostree_async_progress_set_uint64 (pull_data->progress, "bytes-transferred", bytes_transferred); ostree_async_progress_set_uint64 (pull_data->progress, "start-time", start_time); diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 4ac39d11..47e95ae4 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3876,6 +3876,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress { GString *buf; g_autofree char *status = NULL; + gboolean scanning; guint outstanding_fetches; guint outstanding_metadata_fetches; guint outstanding_writes; @@ -3889,6 +3890,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress outstanding_fetches = ostree_async_progress_get_uint (progress, "outstanding-fetches"); outstanding_metadata_fetches = ostree_async_progress_get_uint (progress, "outstanding-metadata-fetches"); outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes"); + scanning = ostree_async_progress_get_uint (progress, "scanning") == 1; n_scanned_metadata = ostree_async_progress_get_uint (progress, "scanned-metadata"); fetched_delta_parts = ostree_async_progress_get_uint (progress, "fetched-delta-parts"); total_delta_parts = ostree_async_progress_get_uint (progress, "total-delta-parts"); @@ -3937,7 +3939,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress formatted_bytes_sec, formatted_bytes_transferred, formatted_total, formatted_est_time_remaining); } - else if (outstanding_metadata_fetches) + else if (scanning || outstanding_metadata_fetches) { g_string_append_printf (buf, "Receiving metadata objects: %u/(estimating) %s/s %s", metadata_fetched, formatted_bytes_sec, formatted_bytes_transferred);