Skip to content

daemon: Reload users less aggressively on wtmp changes

Ray Strode requested to merge wtmp-rate-limits into main

accountsservice parses wtmp anytime it changes, so that it has an accurate accounting of user login frequency. This is important so that, e.g., the login screen can show the list of users in the order they use the system the most.

The wtmp file can get very big though and take a long time to parse.

Furthermore, in one scenario where it gets big, a user constantly logging in and out of the system, it also get written to frequently. In that case accountsservice basically constantly reparses the big file, chewing through CPU.

This commit attempts to mitigate that scenario, by more aggressively rate limiting how often it reparses the file.

Previously it would only parse the file 2 times a seconds at most. Now it only parses the file once every 10 seconds at most.

Closes: #104 (closed)

Merge request reports