An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve indexing
Daniel2ebd547c3c7b
diff --git a/kernel/job/cron.go b/kernel/job/cron.goindex 5d77694842..8d583f7f3d 100644--- a/kernel/job/cron.go+++ b/kernel/job/cron.go@@ -39,7 +39,6 @@ func StartCron() {go every(util.SQLFlushInterval, sql.FlushTxJob)go every(util.SQLFlushInterval, sql.FlushHistoryTxJob)go every(util.SQLFlushInterval, sql.FlushAssetContentTxJob)- go every(50*time.Microsecond, model.PollPushQueue)go every(10*time.Minute, model.IndexEmbedBlockJob)go every(10*time.Minute, model.CacheVirtualBlockRefJob)go every(30*time.Second, model.OCRAssetsJob)@@ -51,6 +50,8 @@ func StartCron() {if util.IsMobileContainer() {go every(7*time.Second, model.AutoConsumeShorthandsJob)}++ model.StartPushQueueConsumer()}func every(interval time.Duration, f func(), name ...string) {diff --git a/kernel/model/push_queue.go b/kernel/model/push_queue.goindex 13388727d6..ee15613654 100644--- a/kernel/model/push_queue.go+++ b/kernel/model/push_queue.go@@ -22,6 +22,7 @@ import ("os""path/filepath""sync"+ "time""github.com/88250/lute""github.com/88250/lute/render"@@ -45,6 +46,7 @@ var (pushMu sync.MutexpushFlock *flock.FlockpushQueuePath string+ pushNotifyCh = make(chan struct{}, 1))func ensurePushQueue() {@@ -103,7 +105,13 @@ func appendPushEntry(entry pushEntry) {data = append(data, '\n')_ = pushFlock.Lock()- defer func() { _ = pushFlock.Unlock() }()+ defer func() {+ _ = pushFlock.Unlock()+ select {+ case pushNotifyCh <- struct{}{}:+ default:+ }+ }()pushMu.Lock()defer pushMu.Unlock()@@ -188,6 +196,20 @@ func PollPushQueue() {clearPushQueue()}+func StartPushQueueConsumer() {+ go func() {+ ticker := time.NewTicker(3 * time.Second)+ defer ticker.Stop()+ for {+ PollPushQueue()+ select {+ case <-pushNotifyCh:+ case <-ticker.C:+ }+ }+ }()+}+func loadPushQueue() (entries []pushEntry) {f, err := os.Open(pushQueuePath)if err != nil {