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
This commit is contained in:
Colin Walters 2017-01-19 05:49:23 -05:00 committed by Atomic Bot
parent f4d1334e19
commit 425ccc0a33
3 changed files with 6 additions and 3 deletions

View File

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

View File

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

View File

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