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

Fix race condition when writing/committing index #36

Conversation

jbeaurivage
Copy link
Contributor

@jbeaurivage jbeaurivage commented Mar 3, 2022

Piggybacking on #21, use sync_all instead of flush.

flush commits the changes to the filesystem, but makes no guarantees as to when those changes will land in the fs. Instead, use sync_all to force the program to wait for the writes to be fully propagated to the file system before committing to the index repo. Otherwise it would sometimes happen that an empty file would be committed and pushed to the index before the additions were written to disk.

Reference: https://stackoverflow.com/questions/69819990/whats-the-difference-between-flush-and-sync-all

Use sync_all instead of flush to wait for the writes to be
fully propagated to the file system before committing to the index repo.
Copy link
Collaborator

Seems good to me, thanks !

be8707e into moriturus:another_main Mar 5, 2022
@jbeaurivage jbeaurivage deleted the fixup/sync-index-files branch March 25, 2022 18:02
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.

2 participants