Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include milliseconds in Windows Stat dates #2106

Merged
merged 3 commits into from
Jul 6, 2021

Conversation

taratatach
Copy link
Member

@taratatach taratatach commented Jul 6, 2021

On Windows, we use a third-party library (i.e.
@gyselroth/windows-fsstat) to compute file and directory stats
because the non-BigInt version of fs.stat would not always return a
unique inode value (i.e. the returned inode value of 2 files or
directories could be the same).
However, this library would truncate all dates to the second and this
can lead us to discard very close modifications since we now expect
the modification date to be different to process a local event as a
modification.

We've modified our fork of @gyselroth/windows-fsstat to include
milliseconds in returned dates and use it in the client.
Since changing the modification date of most files would trigger a lot
of checksums re-computing, we include a "migration" to prevent this
during the first initial scan.

Please make sure the following boxes are checked:

  • PR is not too big
  • it improves UX & DX in some way
  • it includes unit tests matching the implementation changes
  • it includes scenarios matching a new behaviour or has been manually tested
  • it includes relevant documentation

@taratatach taratatach changed the title Bump @gyselroth/windows-fsstat to v1.0.0 Include milliseconds in Windows Stat dates Jul 6, 2021
  This version returns access and modification dates with milliseconds
  instead of truncating them to the second.
  Atom Watcher steps were passed the client sync path directly by the
  watcher.

  However, we'll want to access other attributes of the configuration in
  some steps so we'll pass the full Config instead and use its syncPath
  attribute when necessary.
  Stat dates on Windows were previously truncated to the second while
  we now get the milliseconds as well.
  To avoid re-calculating all the local checksums during the initial
  scan because of the date migration, we'll truncate `scan` events
  dates to the second during the first initial scan following the
  publication of v3.28.1 when checking if the checksum of a given file
  can be reused or not.

  When publishing v3.28.2 or greater, we can remove
  `WINDOWS_DATE_MIGRATION_FLAG` and stop truncating dates during the
  initial scan.

  Users who will have skipped the version introducing the flag will
  see all their checksums re-computed.
@taratatach taratatach force-pushed the windows/include-milliseconds-in-stat-dates branch from 3cf1e7b to d9c069f Compare July 6, 2021 14:50
@taratatach taratatach marked this pull request as ready for review July 6, 2021 14:51
@taratatach taratatach requested a review from nono July 6, 2021 14:51
@taratatach taratatach self-assigned this Jul 6, 2021
@taratatach taratatach merged commit dea4063 into master Jul 6, 2021
@taratatach taratatach deleted the windows/include-milliseconds-in-stat-dates branch July 6, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants