fix: 优雅停机停等任务 goroutine,根治 TempDir 清理竞态
新增 Server.Close / Engine.StopAll:取消 ctx 后依次等 side-flusher、 后台循环、各任务 planner/worker、归档 worker 退出;测试用 defer s.Close() 在清理前排空 goroutine,遂把 tempDir 兜底改回 t.TempDir() 并删除 helper。
This commit is contained in:
1 parent
f8454d310b
commit
98515a3974
10 files changed
+75
-6
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user