Make cacheFile thread-safe using file locks - #520
Conversation
|
I think While the lock might be useful regardless, e.g. on windows this might be a thing that helps with multiple processes trying to open a file, I think we need to be able to specify the |
Fair! Do the last two commits correspond to what you had in mind? I kept the previous API-exposed function that default to the environment usage. I can drop those if you don't think they're useful to keep. |
ab71583 to
6b0cf08
Compare
fendor
left a comment
There was a problem hiding this comment.
Yes, this is what I had in mind!
I think this is what we want. All the FilePaths are making me dizzy though, perhaps a newtype CacheDir = CacheDir FilePath is appropriate?
e49e624 to
57e9245
Compare
fendor
left a comment
There was a problem hiding this comment.
LGTM, just one improvement to the testsuite, then this is ready to merge :)
|
Tick the box to add this pull request to the merge queue (same as
|
This was mentioned on on Matrix.
Changes include:
cacheFileInthat allows varying the cache directory used, overriding the default behavior of using$XDG_CACHE_HOME.As long as downstream consumers were using the
srcHashparameter as a content addressed tag, I don't think they have to necessarily usecacheFileInand can keep usingcacheFileas is after this change. I exportedcacheFileInmainly for the test I added.