You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When looking into a memory leak with peripherals PR, claude randomly pointed out that this check was incorrect, and actually the reverse of what is desired. So I did some digging.
From my understanding, m_cache hold the list of files for a directory, and a timestamp for when that list should be considered stale. If the path is stale, it should return false without assigning a value to items, which will cause a fresh pull of the directory contents, which is placed back into the cache. If not stale, it returns the cache contents and true, so no disk reads are necessary.
I applied some logs to the function and found that indeed the existing code does appear to do the exact opposite of what is wanted here. Instead of returning false on the first call with a stale cache, it would return true, and then proceed to return false to every proceeding call. This would result in stale data being returned the first call, then no cache return for the rest.
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
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.
When looking into a memory leak with peripherals PR, claude randomly pointed out that this check was incorrect, and actually the reverse of what is desired. So I did some digging.
From my understanding,
m_cachehold the list of files for a directory, and a timestamp for when that list should be considered stale. If the path is stale, it should return false without assigning a value to items, which will cause a fresh pull of the directory contents, which is placed back into the cache. If not stale, it returns the cache contents and true, so no disk reads are necessary.I applied some logs to the function and found that indeed the existing code does appear to do the exact opposite of what is wanted here. Instead of returning false on the first call with a stale cache, it would return true, and then proceed to return false to every proceeding call. This would result in stale data being returned the first call, then no cache return for the rest.