mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 00:36:56 +08:00
robustness: shared HTTP client, HTTP status checks, abort controller, streaming perf
- web.go: reuse shared binanceClient with connection pooling instead of per-request client - sentinel.go: check HTTP status code before parsing Binance ticker response - brain.go: check HTTP status codes in news scan and market brief APIs - brain.go: add cleanStaleSignals() to prevent unbounded sync.Map growth - scheduler.go: periodically clean expired pending trades - AgentChatPage.tsx: add AbortController to cancel in-flight requests - AgentChatPage.tsx: check response.ok before parsing JSON - AgentChatPage.tsx: batch word streaming (~40 frames max) to reduce re-renders - AgentChatPage.tsx: handle AbortError gracefully (remove orphan bot message)
This commit is contained in:
@@ -43,10 +43,14 @@ func (s *Scheduler) Start(ctx context.Context) {
|
||||
lastCheck = now
|
||||
}
|
||||
// Clean stale chat history every hour (sessions idle > 24h)
|
||||
// and expired pending trades
|
||||
if now.Sub(lastCleanup) > 1*time.Hour {
|
||||
if s.agent.history != nil {
|
||||
s.agent.history.CleanOld(24 * time.Hour)
|
||||
}
|
||||
if s.agent.pending != nil {
|
||||
s.agent.pending.CleanExpired()
|
||||
}
|
||||
lastCleanup = now
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user