fix(folders): honour folder_N_refresh instead of walking every cycle - #3676
Merged
nicolargo merged 1 commit intoAug 26, 2026
Merged
Conversation
update() guarded the per-folder timer with `i in self.timer_folders`, which asks whether the integer i is one of the Timer objects in the list. Timer does not implement __eq__, so that test is always False: the skip branch was unreachable and the reset branch never ran. The consequence is that folder_N_refresh has no effect. Every folder is re-walked on every refresh cycle (2s by default) rather than on its own schedule, and folder_size() is a full recursive walk - which is exactly why the setting exists. Use the index bound the code meant, `i < len(self.timer_folders)`. The guard still earns its place: the folder list lives on the class, so it can outgrow the per-instance timer list.
Owner
|
Thanks for the PR @ntdatt812 This one is tricky ! Merged into develop. |
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
FolderList.update()guards the per-folder timer like this:iis a list index;self.timer_foldersis a list ofTimerobjects.i in self.timer_foldersis a membership test, not a bounds check — it asks whether the integeriequals one of the timers.Timerdoesn't implement__eq__, so it is alwaysFalse:So the skip branch is unreachable, and the
self.timer_folders[i].reset()below it never runs either.What it costs
folder_N_refreshhas no effect. Every monitored folder is re-walked on every refresh cycle (2s by default) instead of on its own schedule — andfolder_size()is a full recursive walk, which is the whole reason the setting exists.Measured with
folder_1_refresh=600andfolder_sizecounted:The fix
Use the bound the code meant:
i < len(self.timer_folders).The guard is worth keeping rather than dropping —
__folder_listis a class attribute whiletimer_foldersis per-instance, so the folder list can outgrow the timer list and the index has to be checked.Tests
tests/test_folder_list_refresh.py, 4 cases: refresh delay honoured, folder walked again once the timer is over, timer restarted after a walk, and a folder with no timer still updated.Mutation-checked — putting
i in self.timer_foldersback turns 2 of the 4 red:ruff checkandruff format --checkclean on both files.