[th/timestamps-periodic-update] core: don't update connection timestamps periodically every 300 seconds

Thomas Haller requested to merge th/timestamps-periodic-update into main

We store the timestamp when a profile activated the last time to "/var/lib/NetworkManager/timestamps". There was also a timer which would update the timestamp of activated connections every 300 seconds.

That seems unnecessary, drop it.

For one, waking up every 5 minutes and rewriting a file to disk seems undesirable, for example if /var is a device where unnecessary writes should be minimized.

Note that we already update the timestamp when a device goes down, and of course when it comes up. Updating the timestamp in between seems unnecessary.

This reverts commit 60735029 ('core: update timestamp in active system connections every 5 mins (bgo #583756)').

An alternative would be to only update the timestamp in memory (so that it would appear updated on D-Bus), but delay writing the file until something important happens. nm_key_file_db_*() already tracks whether there are changes ("dirty") and whether it's necessary to write the file. It would be possible to track two dirty flags: one that requires immediate update, and one that only ensures we will re-write dirty files eventually.

See-also: https://bugzilla.gnome.org/show_bug.cgi?id=583756

Inspired by https://unix.stackexchange.com/questions/694260/how-to-prevent-networkmanager-from-writing-timestamps-to-var-lib-networkmanager

Edited by Thomas Haller

Merge request reports