progress: Update at 300msec on the CLI

Writing things on the console every 100msec doesn't really
make any sense, the progress bar is not finegrained enough
and you can't read the text that fast anyway.
tingping/wmclass
Alexander Larsson 2017-05-23 10:18:35 +02:00
parent aeb31f7941
commit c8659e4530
3 changed files with 11 additions and 1 deletions

View File

@ -1799,6 +1799,7 @@ repo_pull_one_dir (OstreeRepo *self,
const char *refs_to_fetch[2];
const char *revs_to_fetch[2];
gboolean res;
guint32 update_freq = 0;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
@ -1829,8 +1830,13 @@ repo_pull_one_dir (OstreeRepo *self,
g_variant_builder_add (&builder, "{s@v}", "override-commit-ids",
g_variant_new_variant (g_variant_new_strv ((const char * const *) revs_to_fetch, -1)));
if (progress != NULL)
update_freq = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (progress), "update-frequency"));
if (update_freq == 0)
update_freq = FLATPAK_DEFAULT_UPDATE_FREQUENCY;
g_variant_builder_add (&builder, "{s@v}", "update-frequency",
g_variant_new_variant (g_variant_new_uint32 (FLATPAK_DEFAULT_UPDATE_FREQUENCY)));
g_variant_new_variant (g_variant_new_uint32 (update_freq)));
options = g_variant_ref_sink (g_variant_builder_end (&builder));

View File

@ -56,6 +56,7 @@ GType flatpak_deploy_get_type (void);
#define FLATPAK_REPO_NODEPS_KEY "NoDeps"
#define FLATPAK_DEFAULT_UPDATE_FREQUENCY 100
#define FLATPAK_CLI_UPDATE_FREQUENCY 300
typedef struct
{

View File

@ -6095,5 +6095,8 @@ flatpak_progress_new (FlatpakProgressCallback progress,
g_object_set_data (G_OBJECT (ostree_progress), "callback", progress);
g_object_set_data (G_OBJECT (ostree_progress), "last_progress", GUINT_TO_POINTER (0));
if (progress == flatpak_terminal_progress_cb)
g_object_set_data (G_OBJECT (ostree_progress), "update-frequency", GUINT_TO_POINTER (FLATPAK_CLI_UPDATE_FREQUENCY));
return ostree_progress;
}