[gnome-software/1487-cancel-ongoing-update-downloads-when-system-power-is-low] gs-update-monitor: Cancel ongoing jobs when system power is low



commit 2780afb6d9a0aae6064af53325243ce6c89e8dbd
Author: Milan Crha <mcrha redhat com>
Date:   Fri Mar 4 11:44:39 2022 +0100

    gs-update-monitor: Cancel ongoing jobs when system power is low
    
    Cancel any ongoing refresh, update download or update install when
    system power is low. Cancel ongoing download when network changes
    to metered.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1487

 src/gs-update-monitor.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 5616d1110..8fffb5911 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -1296,10 +1296,14 @@ gs_update_monitor_power_profile_changed_cb (GObject    *object,
        GsUpdateMonitor *self = GS_UPDATE_MONITOR (user_data);
 
        if (g_power_profile_monitor_get_power_saver_enabled (self->power_profile_monitor)) {
-               /* Cancel an ongoing refresh if we’re now in power saving mode. */
+               /* Cancel ongoing jobs, if we’re now in power saving mode. */
                g_cancellable_cancel (self->refresh_cancellable);
                g_object_unref (self->refresh_cancellable);
                self->refresh_cancellable = g_cancellable_new ();
+
+               g_cancellable_cancel (self->cancellable);
+               g_object_unref (self->cancellable);
+               self->cancellable = g_cancellable_new ();
        } else {
                /* Else, it might be time to check for updates */
                check_updates (self);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]