Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 304612 Details for
Bug 445292
pk should wait a little after start-up or resume before chekcing for updates
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
suggested patch
packagekit-state-changed-reason.patch (text/plain), 7.93 KB, created by
Richard Hughes
on 2008-05-06 09:29:20 UTC
(
hide
)
Description:
suggested patch
Filename:
MIME Type:
Creator:
Richard Hughes
Created:
2008-05-06 09:29:20 UTC
Size:
7.93 KB
patch
obsolete
>commit cc3f96c5c10c8398ab7cfe0aa79d6393cd1df670 >Author: Richard Hughes <richard@hughsie.com> >Date: Tue May 6 10:26:16 2008 +0100 > > add a 'reason' parameter to StateHasChanged() so we can > wait different timeouts for priority and normal reasons. fixes rh#445292 > >diff --git a/contrib/yum-packagekit/refresh-packagekit.py b/contrib/yum-packagekit/refresh-packagekit.py >index 247be9b..634d585 100644 >--- a/contrib/yum-packagekit/refresh-packagekit.py >+++ b/contrib/yum-packagekit/refresh-packagekit.py >@@ -34,7 +34,7 @@ def posttrans_hook(conduit): > packagekit_proxy = bus.get_object('org.freedesktop.PackageKit', > '/org/freedesktop/PackageKit') > packagekit_iface = dbus.Interface(packagekit_proxy, 'org.freedesktop.PackageKit') >- packagekit_iface.StateHasChanged() >+ packagekit_iface.StateHasChanged('posttrans') > except dbus.DBusException, e: > conduit.info(2, "Unable to send message to PackageKit") > conduit.info(6, "%s" %(e,)) >diff --git a/data/95packagekit b/data/95packagekit >index f6e72c3..407cd1a 100755 >--- a/data/95packagekit >+++ b/data/95packagekit >@@ -13,7 +13,8 @@ case "$1" in > dbus-send --system --dest=org.freedesktop.PackageKit \ > --type=method_call --print-reply \ > /org/freedesktop/PackageKit \ >- org.freedesktop.PackageKit.StateHasChanged >+ org.freedesktop.PackageKit.StateHasChanged \ >+ string:'resume' > ;; > *) > ;; >diff --git a/src/pk-engine.c b/src/pk-engine.c >index 654b126..0638e4d 100644 >--- a/src/pk-engine.c >+++ b/src/pk-engine.c >@@ -68,16 +68,26 @@ static void pk_engine_finalize (GObject *object); > #define PK_ENGINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_ENGINE, PkEnginePrivate)) > > /** >- * PK_ENGINE_STATE_CHANGED_TIMEOUT: >+ * PK_ENGINE_STATE_CHANGED_PRIORITY_TIMEOUT: > * > * The timeout in seconds to wait when we get the StateHasChanged method. >- * We don't want to queue these transactions if one is already in progress. >+ * We don't queue these transactions if one is already in progress. > * >- * We probably also need to wait for NetworkManager to come back up if we are >- * resuming, and we probably don't want to be doing this at a busy time after >- * a yum transaction. >+ * This should be used when a native tool has been used, and the update UI should >+ * be updated to reflect reality. > */ >-#define PK_ENGINE_STATE_CHANGED_TIMEOUT 10 /* seconds */ >+#define PK_ENGINE_STATE_CHANGED_PRIORITY_TIMEOUT 5 /* seconds */ >+ >+/** >+ * PK_ENGINE_STATE_CHANGED_NORMAL_TIMEOUT: >+ * >+ * The timeout in seconds to wait when we get the StateHasChanged method (for selected reasons). >+ * We don't queue these transactions if one is already in progress. >+ * >+ * We probably don't want to be doing an update check at the busy time after a resume, or for >+ * other non-critical reasons. >+ */ >+#define PK_ENGINE_STATE_CHANGED_NORMAL_TIMEOUT 10*60 /* seconds */ > > struct PkEnginePrivate > { >@@ -95,7 +105,8 @@ struct PkEnginePrivate > PkRoleEnum actions; > PkGroupEnum groups; > PkFilterEnum filters; >- gboolean signal_state_timeout; /* don't queue StateHasChanged */ >+ guint signal_state_priority_timeout; >+ guint signal_state_normal_timeout; > }; > > enum { >@@ -302,7 +313,7 @@ pk_engine_state_changed_cb (gpointer data) > /* if network is not up, then just reschedule */ > state = pk_network_get_network_state (engine->priv->network); > if (state == PK_NETWORK_ENUM_OFFLINE) { >- /* wait another timeout of PK_ENGINE_STATE_CHANGED_TIMEOUT */ >+ /* wait another timeout of PK_ENGINE_STATE_CHANGED_x_TIMEOUT */ > return TRUE; > } > >@@ -312,7 +323,8 @@ pk_engine_state_changed_cb (gpointer data) > pk_notify_updates_changed (engine->priv->notify); > > /* reset, now valid */ >- engine->priv->signal_state_timeout = 0; >+ engine->priv->signal_state_priority_timeout = 0; >+ engine->priv->signal_state_normal_timeout = 0; > > return FALSE; > } >@@ -324,21 +336,47 @@ pk_engine_state_changed_cb (gpointer data) > * have finished their transaction, and the update cache may not be valid. > **/ > gboolean >-pk_engine_state_has_changed (PkEngine *engine, GError **error) >+pk_engine_state_has_changed (PkEngine *engine, const gchar *reason, GError **error) > { >+ gboolean is_priority = TRUE; >+ > g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE); > >- if (engine->priv->signal_state_timeout != 0) { >+ /* have we already scheduled priority? */ >+ if (engine->priv->signal_state_priority_timeout != 0) { > g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INVALID_STATE, >- "Already asked to refresh state less than %i seconds ago", >- PK_ENGINE_STATE_CHANGED_TIMEOUT); >+ "Already asked to refresh priority state less than %i seconds ago", >+ PK_ENGINE_STATE_CHANGED_PRIORITY_TIMEOUT); > return FALSE; > } > >- /* wait a little delay in case we get multiple requests */ >- engine->priv->signal_state_timeout = g_timeout_add_seconds (PK_ENGINE_STATE_CHANGED_TIMEOUT, >- pk_engine_state_changed_cb, engine); >+ /* don't bombard the user 10 seconds after resuming */ >+ if (pk_strcmp (reason, "resume")) { >+ is_priority = FALSE; >+ } > >+ /* are we normal, and already scheduled normal? */ >+ if (!is_priority && engine->priv->signal_state_normal_timeout != 0) { >+ g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INVALID_STATE, >+ "Already asked to refresh normal state less than %i seconds ago", >+ PK_ENGINE_STATE_CHANGED_NORMAL_TIMEOUT); >+ return FALSE; >+ } >+ >+ /* are we priority, and already scheduled normal? */ >+ if (is_priority && engine->priv->signal_state_normal_timeout != 0) { >+ /* clear normal, as we are about to schedule a priority */ >+ g_source_remove (engine->priv->signal_state_normal_timeout); >+ engine->priv->signal_state_normal_timeout = 0; } >+ >+ /* wait a little delay in case we get multiple requests */ >+ if (is_priority) { >+ engine->priv->signal_state_priority_timeout = g_timeout_add_seconds (PK_ENGINE_STATE_CHANGED_PRIORITY_TIMEOUT, >+ pk_engine_state_changed_cb, engine); >+ } else { >+ engine->priv->signal_state_normal_timeout = g_timeout_add_seconds (PK_ENGINE_STATE_CHANGED_NORMAL_TIMEOUT, >+ pk_engine_state_changed_cb, engine); >+ } > return TRUE; > } > >@@ -575,7 +613,8 @@ pk_engine_init (PkEngine *engine) > engine->priv->cache = pk_cache_new (); > > /* we need to be able to clear this */ >- engine->priv->signal_state_timeout = 0; >+ engine->priv->signal_state_priority_timeout = 0; >+ engine->priv->signal_state_normal_timeout = 0; > > /* get another connection */ > connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); >@@ -637,9 +676,13 @@ pk_engine_finalize (GObject *object) > } > > /* if we set an state changed notifier, clear */ >- if (engine->priv->signal_state_timeout != 0) { >- g_source_remove (engine->priv->signal_state_timeout); >- engine->priv->signal_state_timeout = 0; >+ if (engine->priv->signal_state_priority_timeout != 0) { >+ g_source_remove (engine->priv->signal_state_priority_timeout); >+ engine->priv->signal_state_priority_timeout = 0; >+ } >+ if (engine->priv->signal_state_normal_timeout != 0) { >+ g_source_remove (engine->priv->signal_state_normal_timeout); >+ engine->priv->signal_state_normal_timeout = 0; > } > > /* compulsory gobjects */ >diff --git a/src/pk-engine.h b/src/pk-engine.h >index 017f847..c59b1f3 100644 >--- a/src/pk-engine.h >+++ b/src/pk-engine.h >@@ -96,6 +96,7 @@ gboolean pk_engine_get_transaction_list (PkEngine *engine, > gchar ***transaction_list, > GError **error); > gboolean pk_engine_state_has_changed (PkEngine *engine, >+ const gchar *reason, > GError **error); > gboolean pk_engine_suggest_daemon_quit (PkEngine *engine, > GError **error); >diff --git a/src/pk-interface.xml b/src/pk-interface.xml >index 1790530..e9e74e1 100644 >--- a/src/pk-interface.xml >+++ b/src/pk-interface.xml >@@ -26,6 +26,7 @@ > <arg type="as" name="transactions" direction="out"/> > </method> > <method name="StateHasChanged"> >+ <arg type="s" name="reason" direction="in"/> > </method> > <method name="SuggestDaemonQuit"> > </method>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 445292
: 304612