Fix sync never ending when pantry is not updated in 24 hours #73
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.
To be clear, pkgx is completely broken by now because of this issue.
It turns out that the function that detects whether the sync was last synced recently isn't working properly, because it's relying on the mtime of the pantry/projects folder, which is set to its original mtime when downloaded by either git or tar.
This means the function would always detect outdated sync if there was no commit in the pantry repo in the last 24 hours.
This was just a quick way around it. Other solutions I tried:
ctime (change time). This would work better, but Deno doesn't support it. (node does)
tar's --touch to reset modification time, but it only works for files not for directories. Also, the pantry could have been downloaded with git.
PS: tests are failing but the code is working, and I'm using it in my fork. I will not bother fixing tests as apparently no one is merging code here anyway.