fix: 优雅停机停等任务 goroutine,根治 TempDir 清理竞态
ci / frontend (push) Successful in 53s
ci / backend (push) Successful in 2m11s

新增 Server.Close / Engine.StopAll:取消 ctx 后依次等 side-flusher、
后台循环、各任务 planner/worker、归档 worker 退出;测试用 defer s.Close()
在清理前排空 goroutine,遂把 tempDir 兜底改回 t.TempDir() 并删除 helper。
This commit is contained in:
wangdefa committed 2026-10-20 23:08:21 -07:00
1 parent f8454d310b
commit 98515a3974
10 files changed
+75 -6

No files matched your search

+2
View File
@@ -19,6 +19,7 @@ func TestChatUnavailableReasonDistinguishesStates(t *testing.T) {
defer m.Close()
td := t.TempDir()
s := New(context.Background(), m, td, td, td)
defer s.Close()
// Start from a clean profile table; other tests in the shared DB may have left rows.
existing, _ := m.pg.ListProfiles()
@@ -69,6 +70,7 @@ func TestResolveChatAgentHonoursConversationProfile(t *testing.T) {
defer m.Close()
td := t.TempDir()
s := New(context.Background(), m, td, td, td)
defer s.Close()
// Force the global fallback to nil so a non-nil result can ONLY come from the
// conversation's own profile — this is exactly the situation the user hit