mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-18 02:14:43 +00:00
fix(channels): add periodic sweep for pending message compaction
Auto-compaction stopped working after server restarts because provider resolution failure was silent and there was no retry mechanism. Add a 10-minute periodic sweep in the flusher loop that checks DB for groups exceeding the compaction threshold, and warn when compaction provider cannot be resolved at startup.
This commit is contained in:
1 parent
ed840dd6d7
commit
9aaec59527
4 files changed
+50
-2
No files matched your search
@@ -282,6 +282,16 @@ func (l *InstanceLoader) loadInstance(ctx context.Context, inst store.ChannelIns
|
||||
pc.SetPendingCompaction(cc)
|
||||
slog.Debug("pending compaction configured", "channel", inst.Name, "provider", p.Name(), "model", model,
|
||||
"threshold", cc.Threshold, "keep_recent", cc.KeepRecent, "max_tokens", cc.MaxTokens)
|
||||
} else {
|
||||
attemptedProvider := ""
|
||||
if l.pendingCompactCfg != nil {
|
||||
attemptedProvider = l.pendingCompactCfg.Provider
|
||||
}
|
||||
if attemptedProvider == "" && ag != nil {
|
||||
attemptedProvider = ag.Provider
|
||||
}
|
||||
slog.Warn("pending compaction not configured: provider/model unavailable",
|
||||
"channel", inst.Name, "agent_id", inst.AgentID, "attempted_provider", attemptedProvider)
|
||||
}
|
||||
}
|
||||
l.manager.RegisterChannel(inst.Name, ch)
|
||||
|
||||
Reference in new issue
Block a user