Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Add internal kernel API `/api/sqlite/flushTransaction` https://github.com/siyuan-note/siyuan/issues/10005

Daniel3016d8eb8c23
diff --git a/kernel/api/router.go b/kernel/api/router.go
index fa2c50019a..31983ffcc2 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -141,6 +141,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/lute/copyStdMarkdown", model.CheckAuth, copyStdMarkdown)
ginServer.Handle("POST", "/api/query/sql", model.CheckAuth, SQL)
+ ginServer.Handle("POST", "/api/sqlite/flushTransaction", model.CheckAuth, model.CheckReadonly, flushTransaction)
ginServer.Handle("POST", "/api/search/searchTag", model.CheckAuth, searchTag)
ginServer.Handle("POST", "/api/search/searchTemplate", model.CheckAuth, searchTemplate)
diff --git a/kernel/api/sql.go b/kernel/api/sql.go
index 3a85400cbb..9238894e06 100644
--- a/kernel/api/sql.go
+++ b/kernel/api/sql.go
@@ -26,6 +26,14 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
+func flushTransaction(c *gin.Context) {
+ // Add internal kernel API `/api/sqlite/flushTransaction` https://github.com/siyuan-note/siyuan/issues/10005
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ sql.FlushQueue()
+}
+
func SQL(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)