mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-17 06:05:29 +01:00
🎨 Warn users about potential performance issues when running on non-SSD drives https://github.com/siyuan-note/siyuan/issues/16835
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
94ae418708
commit
2df2f2eb3a
18 changed files with 82 additions and 18 deletions
|
|
@ -41,6 +41,7 @@ require (
|
|||
github.com/gorilla/css v1.0.1
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/imroc/req/v3 v3.57.0
|
||||
github.com/jaypipes/ghw v0.21.2
|
||||
github.com/jinzhu/copier v0.4.0
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/klippa-app/go-pdfium v1.17.2
|
||||
|
|
@ -58,7 +59,7 @@ require (
|
|||
github.com/sashabaranov/go-openai v1.41.2
|
||||
github.com/shirou/gopsutil/v4 v4.25.12
|
||||
github.com/siyuan-note/dataparser v0.0.0-20260115084335-b57cb8bc7c17
|
||||
github.com/siyuan-note/dejavu v0.0.0-20260115094723-6e0b1a18fe74
|
||||
github.com/siyuan-note/dejavu v0.0.0-20260115100906-6ced11ea86cd
|
||||
github.com/siyuan-note/encryption v0.0.0-20251120032857-3ddc3c2cc49f
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97
|
||||
github.com/siyuan-note/filelock v0.0.0-20251212095217-08318833e008
|
||||
|
|
@ -143,6 +144,7 @@ require (
|
|||
github.com/hhrutter/tiff v1.0.2 // indirect
|
||||
github.com/huandu/xstrings v1.5.0 // indirect
|
||||
github.com/icholy/digest v1.1.0 // indirect
|
||||
github.com/jaypipes/pcidb v1.1.1 // indirect
|
||||
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 // indirect
|
||||
github.com/jolestar/go-commons-pool/v2 v2.1.2 // indirect
|
||||
github.com/juju/errors v1.0.0 // indirect
|
||||
|
|
@ -189,6 +191,7 @@ require (
|
|||
golang.org/x/tools v0.40.0 // indirect
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
howett.net/plist v1.0.2-0.20250314012144-ee69052608d9 // indirect
|
||||
modernc.org/fileutil v1.3.40 // indirect
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -243,6 +243,10 @@ github.com/icholy/digest v1.1.0 h1:HfGg9Irj7i+IX1o1QAmPfIBNu/Q5A5Tu3n/MED9k9H4=
|
|||
github.com/icholy/digest v1.1.0/go.mod h1:QNrsSGQ5v7v9cReDI0+eyjsXGUoRSUZQHeQ5C4XLa0Y=
|
||||
github.com/imroc/req/v3 v3.57.0 h1:LMTUjNRUybUkTPn8oJDq8Kg3JRBOBTcnDhKu7mzupKI=
|
||||
github.com/imroc/req/v3 v3.57.0/go.mod h1:JL62ey1nvSLq81HORNcosvlf7SxZStONNqOprg0Pz00=
|
||||
github.com/jaypipes/ghw v0.21.2 h1:woW0lqNMPbYk59sur6thOVM8YFP9Hxxr8PM+JtpUrNU=
|
||||
github.com/jaypipes/ghw v0.21.2/go.mod h1:GPrvwbtPoxYUenr74+nAnWbardIZq600vJDD5HnPsPE=
|
||||
github.com/jaypipes/pcidb v1.1.1 h1:QmPhpsbmmnCwZmHeYAATxEaoRuiMAJusKYkUncMC0ro=
|
||||
github.com/jaypipes/pcidb v1.1.1/go.mod h1:x27LT2krrUgjf875KxQXKB0Ha/YXLdZRVmw6hH0G7g8=
|
||||
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
|
||||
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 h1:iCHtR9CQyktQ5+f3dMVZfwD2KWJUgm7M0gdL9NGr8KA=
|
||||
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
|
||||
|
|
@ -375,8 +379,8 @@ github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05Ut
|
|||
github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=
|
||||
github.com/siyuan-note/dataparser v0.0.0-20260115084335-b57cb8bc7c17 h1:cZbH1QcW/LWYtaKBv2i0O96qVm6HXKeEE3Z74VYdUHM=
|
||||
github.com/siyuan-note/dataparser v0.0.0-20260115084335-b57cb8bc7c17/go.mod h1:zE2SJ4t+2lFAeLgmhi27YtfzdyOWh3l9DXXUr9m/xU0=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20260115094723-6e0b1a18fe74 h1:g1VIRSqpKUnSgV8LLtjWPOuII48ZL4raOW8fx2q+/hM=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20260115094723-6e0b1a18fe74/go.mod h1:WLGbo6s7L8Ed4W0hnDj9ofJ9mcQMlkjv3/JOp7RyrEk=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20260115100906-6ced11ea86cd h1:DIMArbQVffxrWnQXDeizBaHdapzc57nrQTnq+kqf4nE=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20260115100906-6ced11ea86cd/go.mod h1:WLGbo6s7L8Ed4W0hnDj9ofJ9mcQMlkjv3/JOp7RyrEk=
|
||||
github.com/siyuan-note/encryption v0.0.0-20251120032857-3ddc3c2cc49f h1:HSgJKIAMgokJDAvBBfRj47SzRSm6mNGssY0Wv7rcEtg=
|
||||
github.com/siyuan-note/encryption v0.0.0-20251120032857-3ddc3c2cc49f/go.mod h1:JE3S9VuJqTggyfhjesNDuqvqrRvwG3IctFjXXchLx1M=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8=
|
||||
|
|
@ -575,6 +579,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
|
||||
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
|
||||
howett.net/plist v1.0.2-0.20250314012144-ee69052608d9 h1:eeH1AIcPvSc0Z25ThsYF+Xoqbn0CI/YnXVYoTLFdGQw=
|
||||
howett.net/plist v1.0.2-0.20250314012144-ee69052608d9/go.mod h1:fyFX5Hj5tP1Mpk8obqA9MZgXT416Q5711SDT7dQLTLk=
|
||||
modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8=
|
||||
modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA=
|
||||
modernc.org/fileutil v1.3.40/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import (
|
|||
"github.com/denisbrodbeck/machineid"
|
||||
"github.com/go-ole/go-ole"
|
||||
"github.com/go-ole/go-ole/oleutil"
|
||||
"github.com/jaypipes/ghw"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
"github.com/siyuan-note/logging"
|
||||
)
|
||||
|
|
@ -105,6 +106,45 @@ func logBootInfo() {
|
|||
if 0 < len(DisabledFeatures) {
|
||||
logging.LogInfof("disabled features [%s]", strings.Join(DisabledFeatures, ", "))
|
||||
}
|
||||
|
||||
if gulu.OS.IsWindows() || gulu.OS.IsLinux() {
|
||||
go func() {
|
||||
if ghw.DriveTypeSSD.String() != getWorkspaceDriveType() {
|
||||
logging.LogWarnf("workspace dir [%s] is not in SSD drive, performance may be affected", WorkspaceDir)
|
||||
WaitForUILoaded()
|
||||
time.Sleep(3 * time.Second)
|
||||
PushErrMsg(Langs[Lang][278], 15000)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
func getWorkspaceDriveType() string {
|
||||
block, err := ghw.Block()
|
||||
if err != nil {
|
||||
logging.LogWarnf("get block storage info failed: %s", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
if gulu.OS.IsWindows() {
|
||||
part := filepath.VolumeName(WorkspaceDir)
|
||||
for _, disk := range block.Disks {
|
||||
for _, partition := range disk.Partitions {
|
||||
if partition.MountPoint == part {
|
||||
return partition.Disk.DriveType.String()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if gulu.OS.IsLinux() {
|
||||
for _, disk := range block.Disks {
|
||||
for _, partition := range disk.Partitions {
|
||||
if strings.HasPrefix(WorkspaceDir, partition.MountPoint) {
|
||||
return partition.Disk.DriveType.String()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func RandomSleep(minMills, maxMills int) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue