Skip to content

fix: File list not working in certain timezones

Paul Slaughter requested to merge ps-fix-file-list-not-working into main

Description

This MR fixes a time-zone dependent issue where the fuzzy file finder would return no results.

What was the cause?

In some time zones, it was possible for FileListWithCache..._shouldUpdateCache to be false from the get-go and never update.

This was because the lastModifiedTime of the file system could return -1 which was the initial _cacheKey of the FileListWithCache.

How come the lastModifiedTime could return -1?

Because of the nature of OverlayFS, the lastModifiedTime is calculated as the Max mtime of of the repo root folder and the deleted file log. The deleted file log mtime will be -1 if the file doesn't exist. The repo root folder mtime is intialized to the DEFAULT_DATE which was mistakenly time zone dependent. Unfortunately, the DEFAULT_DATE was time zone dependent in such a way that certain timezones yield a very small negative number when DEFAULT_DATE.getTime.

This means that in certain time zones the lastModifiedTime would yield -1, which matches the initial FileListWithCache cache key.

Screenshot

The fuzzy file finder works

Screenshot_2023-04-18_at_12.26.22_AM

Edited by Paul Slaughter

Merge request reports