From a190066523f82a776b8fefb76182d07f813c6f11 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 22 Dec 2023 10:21:15 +0800 Subject: [PATCH] :art: Concurrency control when requesting the kernel API https://github.com/siyuan-note/siyuan/issues/9939 --- kernel/model/session.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/model/session.go b/kernel/model/session.go index 75ca732d6..d25950deb 100644 --- a/kernel/model/session.go +++ b/kernel/model/session.go @@ -28,6 +28,7 @@ import ( "github.com/88250/gulu" "github.com/gin-gonic/gin" + "github.com/gorilla/websocket" "github.com/siyuan-note/logging" "github.com/siyuan-note/siyuan/kernel/util" "github.com/steambap/captcha" @@ -325,6 +326,11 @@ var ( ) func ControlConcurrency(c *gin.Context) { + if websocket.IsWebSocketUpgrade(c.Request) { + c.Next() + return + } + requestingLock.Lock() mutex := requesting[c.Request.URL.Path] if nil == mutex {