[gnome-software/wip/kalev/flatpak-xmlb-invalidate-cache: 2/2] flatpak: Invalidate xmlb cache when adding / removing remotes



commit ef51a71349c46e14af05e0fa29c1cbc3fdcc1496
Author: Kalev Lember <klember redhat com>
Date:   Wed Oct 23 14:43:45 2019 +0200

    flatpak: Invalidate xmlb cache when adding / removing remotes
    
    This ensures that we pick up the newly available apps immediately.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/586

 plugins/flatpak/gs-flatpak.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 7842ca73..a08aad8f 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1313,6 +1313,12 @@ gs_flatpak_app_install_source (GsFlatpak *self, GsApp *app,
                return FALSE;
        }
 
+       /* invalidate cache */
+       g_rw_lock_reader_lock (&self->silo_lock);
+       if (self->silo != NULL)
+               xb_silo_invalidate (self->silo);
+       g_rw_lock_reader_unlock (&self->silo_lock);
+
        /* success */
        gs_app_set_state (app, AS_APP_STATE_INSTALLED);
        return TRUE;
@@ -2426,6 +2432,13 @@ gs_flatpak_app_remove_source (GsFlatpak *self,
                gs_app_set_state_recover (app);
                return FALSE;
        }
+
+       /* invalidate cache */
+       g_rw_lock_reader_lock (&self->silo_lock);
+       if (self->silo != NULL)
+               xb_silo_invalidate (self->silo);
+       g_rw_lock_reader_unlock (&self->silo_lock);
+
        gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
        return TRUE;
 }


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