Unverified Commit eaba1f30 authored by Thomas Haller's avatar Thomas Haller
Browse files

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 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

!1171
parent a640d0b7
Pipeline #548460 passed with stages
in 28 minutes and 48 seconds
...@@ -7802,29 +7802,6 @@ auth_mgr_changed(NMAuthManager *auth_manager, gpointer user_data) ...@@ -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 void
nm_manager_unblock_failed_ovs_interfaces(NMManager *self) nm_manager_unblock_failed_ovs_interfaces(NMManager *self)
{ {
...@@ -8058,12 +8035,6 @@ nm_manager_init(NMManager *self) ...@@ -8058,12 +8035,6 @@ nm_manager_init(NMManager *self)
_LOGW(LOGD_CORE, "failed to monitor kernel firmware directory '%s'.", KERNEL_FIRMWARE_DIR); _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->metered = NM_METERED_UNKNOWN;
priv->sleep_devices = g_hash_table_new(nm_direct_hash, NULL); priv->sleep_devices = g_hash_table_new(nm_direct_hash, NULL);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment