mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 20:11:53 +08:00
🎨 Improve kernel stability https://github.com/siyuan-note/siyuan/issues/9912
This commit is contained in:
parent
7b16c45c8e
commit
e02d0daa53
@ -22,6 +22,8 @@ import (
|
||||
"encoding/base64"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/siyuan-note/filelock"
|
||||
)
|
||||
|
||||
// 以下是七牛云 Hash 算法实现 https://github.com/qiniu/qetag/blob/master/qetag.go
|
||||
@ -53,11 +55,11 @@ func GetEtagByHandle(f io.Reader, size int64) (etag string, err error) {
|
||||
}
|
||||
|
||||
func GetEtag(filename string) (etag string, err error) {
|
||||
f, err := os.Open(filename)
|
||||
f, err := filelock.OpenFile(filename, os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
defer filelock.CloseFile(f)
|
||||
|
||||
fi, err := f.Stat()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user