Skip to content

common: Report the age of the configuration - #6532

Merged
swick merged 1 commit into
flatpak:mainfrom
gordonmessmer:config-time
Apr 20, 2026
Merged

swick merged 1 commit into
flatpak:mainfrom
gordonmessmer:config-time

Conversation

@gordonmessmer

@gordonmessmer gordonmessmer commented Mar 15, 2026 •

Copy link
Copy Markdown

This change will allow applications to determine if their data is older than the flatpak configuration, to aid cache invalidation.

@gordonmessmer

Copy link
Copy Markdown
Author

Specifically: gnome-software parses appstream data on startup, which is extremely expensive. It is already using libxmlb, which allows applications to avoid parsing XML data, but it needs to be able to determine the age of the list of remotes in order to determine whether or not the cache is valid.

If flatpak can provide the age of the remotes config, then gnome-software could use that information to load a previously-built cache and significantly reduce startup time. (Expected to reduce startup by almost 4s)

@gordonmessmer
gordonmessmer marked this pull request as draft March 15, 2026 03:54
@gordonmessmer
gordonmessmer force-pushed the config-time branch 5 times, most recently from bc25382 to 29e2b23 Compare March 15, 2026 06:32
@gordonmessmer
gordonmessmer marked this pull request as ready for review March 15, 2026 06:40
@gordonmessmer

Copy link
Copy Markdown
Author

Related: https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/2395

@gordonmessmer
gordonmessmer marked this pull request as draft March 16, 2026 05:18
@swick

swick commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

The changes to flatpak seem fine to me, but I'll leave it up to the gnome-software developers to decide if this is a worthwhile approach.

@pwithnall pwithnall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a worthwhile approach, yes please.

@gordonmessmer

Copy link
Copy Markdown
Author

Ater working with the gnome-software patch linked above for a while longer, I'd like to see if this can be better aligned with flatpak_installation_create_monitor / less specific to the remotes config. I'll come back to it shortly, but I'd be grateful for suggestions. Thanks.

@gordonmessmer

Copy link
Copy Markdown
Author

Minor changes:

  • this version is slightly simpler (at least in that it touches fewer files)
  • it's more consistent flatpak_installation_create_monitor, since it checks the .changed file
  • reports the age of the installation, rather than the mtime, like the PR title says.

Let me know what you think.

@swick swick left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks good after squashing.

@pwithnall pwithnall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve got a review in progress on https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/2395 (sorry I’ve not finished it yet, that’s not very helpful of me), but one of the comments was:

Why use an age rather than mtime? Comparing ages across multiple files sounds like a recipe for a race condition if the checks span the boundary between one second and the next. Using an mtime avoids that.

@gordonmessmer

Copy link
Copy Markdown
Author

Why use an age rather than mtime

That's actually the main reason this PR is still a draft: I was asking myself the same question and didn't have an answer.

The use of file age ended up in some older revision of the gnome-software PR through copy/paste adapting other sections of the code, and then here for consistency.

I'll update both PRs later today (hopefully) to drop the use of age, and then I'll remove the draft status from this PR.

Thanks!

@pwithnall pwithnall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM now, thanks

@gordonmessmer
gordonmessmer marked this pull request as ready for review April 12, 2026 02:13
@swick

swick commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

@gordonmessmer please squash the changes

@swick swick added this to the 1.18 milestone Apr 16, 2026
This change will allow applications to determine if their data
is older than the flatpak configuration, to aid cache invalidation.
@swick
swick added this pull request to the merge queue Apr 20, 2026
Merged via the queue into flatpak:main with commit fffe38a Apr 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants