Create directory before locking lock file (#2160)

This commit is contained in:
Ori Newman 2022-10-24 00:41:59 +03:00 committed by GitHub
parent d8350d62b0
commit 2d54c9693b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -414,6 +414,11 @@ func (d *File) TryLock() error {
}
lockFile := flock.New(d.path + ".lock")
err := createFileDirectoryIfDoesntExist(lockFile.Path())
if err != nil {
return err
}
flockMap[d.path] = lockFile
success, err := lockFile.TryLock()