mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 19:41:05 +08:00
🎨 Some kernel interface concurrency is no longer controlled to improve performance https://github.com/siyuan-note/siyuan/issues/10149
This commit is contained in:
parent
ae366b5c44
commit
ac30332d40
@ -331,11 +331,31 @@ func ControlConcurrency(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reqPath := c.Request.URL.Path
|
||||||
|
|
||||||
|
// Improve the concurrency of the kernel data reading interfaces https://github.com/siyuan-note/siyuan/issues/10149
|
||||||
|
if strings.HasPrefix(reqPath, "/stage/") || strings.HasPrefix(reqPath, "/assets/") || strings.HasPrefix(reqPath, "/appearance/") {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := strings.Split(reqPath, "/")
|
||||||
|
function := parts[len(parts)-1]
|
||||||
|
if strings.HasPrefix(function, "get") || strings.HasPrefix(function, "list") ||
|
||||||
|
strings.HasPrefix(function, "search") || strings.HasPrefix(function, "render") || strings.HasPrefix(function, "ls") {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(function, "/api/query/") || strings.HasPrefix(function, "/api/search/") {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
requestingLock.Lock()
|
requestingLock.Lock()
|
||||||
mutex := requesting[c.Request.URL.Path]
|
mutex := requesting[reqPath]
|
||||||
if nil == mutex {
|
if nil == mutex {
|
||||||
mutex = &sync.Mutex{}
|
mutex = &sync.Mutex{}
|
||||||
requesting[c.Request.URL.Path] = mutex
|
requesting[reqPath] = mutex
|
||||||
}
|
}
|
||||||
requestingLock.Unlock()
|
requestingLock.Unlock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user