fsmonitor--daemon: periodically truncate list of modified files
commit50c725d6b6f52b1c7fc4940c092d7f205cb99583
authorJeff Hostetler <jeffhost@microsoft.com>
Fri, 25 Mar 2022 18:03:10 +0000 (25 18:03 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 25 Mar 2022 23:04:17 +0000 (25 16:04 -0700)
tree444523f3c585f6c2bac248fe9799d56c4e09a293
parentad2b54e3e89d715a283a3c3ab6262c9bed8cb3a1
fsmonitor--daemon: periodically truncate list of modified files

Teach fsmonitor--daemon to periodically truncate the list of
modified files to save some memory.

Clients will ask for the set of changes relative to a token that they
found in the FSMN index extension in the index.  (This token is like a
point in time, but different).  Clients will then update the index to
contain the response token (so that subsequent commands will be
relative to this new token).

Therefore, the daemon can gradually truncate the in-memory list of
changed paths as they become obsolete (older than the previous token).
Since we may have multiple clients making concurrent requests with a
skew of tokens and clients may be racing to the talk to the daemon,
we lazily truncate the list.

We introduce a 5 minute delay and truncate batches 5 minutes after
they are considered obsolete.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsmonitor--daemon.c