[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73855: [PATCH] * lisp/autorevert.el: Avoid reverting buffer in short
From: |
Lin Sun |
Subject: |
bug#73855: [PATCH] * lisp/autorevert.el: Avoid reverting buffer in short time |
Date: |
Sat, 19 Oct 2024 05:58:14 +0000 |
On Fri, Oct 18, 2024 at 7:50 AM Michael Albinus <michael.albinus@gmx.de> wrote:
>
> In your case, where mass write happens to a file, I recommend to set
> auto-revert-use-notify to nil. Polling is used then instead, with
> auto-revert-interval interval between reverts. The default value is 5
> (seconds), you might change it to 1.
>
> Furthermore, your use case doesn't look ideal for enabling
> auto-revert-mode. Checking fast changing log files is better done with
> auto-revert-tail-mode.
>
Thanks for the comments, the tail mode worked for me; but actually I
enabled the global-auto-revert-mode, I have to manually switch to tail
mode for some buffers. And yes, the default interval value is 5
seconds.
Let's look at this case: the auto-revert-interval is 5, a writing
happened 1 write / second, total 20 writings (in 20 seconds). The
revert-handler run on: first time (T0), and then locks for 5 seconds;
then T5 lock done, revert the buffer; then T6 reverts the and locks it
again... The revert happened as below:
T0...T5,T6...T11,T12...T17,T18...T23
The T5,T6 are nearby, similar happened on T11,T12, and after each lock
end, there is a revert executed nearby.
This patch try to enhance the lock, then makes the revert happened on:
T0...T5...T10...T15...
That reduced loading on my local.
Best Regards, Lin