mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
🎨 Concurrency control when requesting the kernel API https://github.com/siyuan-note/siyuan/issues/9939
This commit is contained in:
parent
c32cad7c3e
commit
a190066523
1 changed files with 6 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ import (
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"github.com/steambap/captcha"
|
"github.com/steambap/captcha"
|
||||||
|
|
@ -325,6 +326,11 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func ControlConcurrency(c *gin.Context) {
|
func ControlConcurrency(c *gin.Context) {
|
||||||
|
if websocket.IsWebSocketUpgrade(c.Request) {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
requestingLock.Lock()
|
requestingLock.Lock()
|
||||||
mutex := requesting[c.Request.URL.Path]
|
mutex := requesting[c.Request.URL.Path]
|
||||||
if nil == mutex {
|
if nil == mutex {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue