summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-03-31 13:41:25 +0200
committerThomas Haller <thaller@redhat.com>2022-04-01 19:36:14 +0200
commiteaba1f30a6450618a7219622629b294736ebb8ec (patch)
treed3e076ea974ad09e022370c6b35940792431fe7d
parenta640d0b7bac81060f29c306616e01296654d27d0 (diff)
downloadNetworkManager-eaba1f30a6450618a7219622629b294736ebb8ec.tar.gz
core: don't update connection timestamps periodically every 300 seconds
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 607350294d6e ('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 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1171
-rw-r--r--src/core/nm-manager.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index b3ea9fea40..521536979f 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -7802,29 +7802,6 @@ auth_mgr_changed(NMAuthManager *auth_manager, gpointer user_data)
/*****************************************************************************/
-static gboolean
-periodic_update_active_connection_timestamps(gpointer user_data)
-{
- NMManager *manager = NM_MANAGER(user_data);
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(manager);
- NMActiveConnection *ac;
- gboolean has_time = FALSE;
- guint64 t = 0;
-
- c_list_for_each_entry (ac, &priv->active_connections_lst_head, active_connections_lst) {
- if (nm_active_connection_get_state(ac) != NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
- continue;
-
- if (!has_time) {
- t = time(NULL);
- has_time = TRUE;
- }
- nm_settings_connection_update_timestamp(nm_active_connection_get_settings_connection(ac),
- t);
- }
- return G_SOURCE_CONTINUE;
-}
-
void
nm_manager_unblock_failed_ovs_interfaces(NMManager *self)
{
@@ -8058,12 +8035,6 @@ nm_manager_init(NMManager *self)
_LOGW(LOGD_CORE, "failed to monitor kernel firmware directory '%s'.", KERNEL_FIRMWARE_DIR);
}
- /* Update timestamps in active connections */
- priv->timestamp_update_id =
- g_timeout_add_seconds(300,
- (GSourceFunc) periodic_update_active_connection_timestamps,
- self);
-
priv->metered = NM_METERED_UNKNOWN;
priv->sleep_devices = g_hash_table_new(nm_direct_hash, NULL);
}