mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 08:46:58 +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:
@@ -116,6 +116,10 @@ func (s *Sentinel) check(symbol string) {
|
||||
resp, err := s.http.Get(fmt.Sprintf("https://fapi.binance.com/fapi/v1/ticker/24hr?symbol=%s", symbol))
|
||||
if err != nil { return }
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
s.logger.Debug("sentinel ticker non-200", "symbol", symbol, "status", resp.StatusCode)
|
||||
return
|
||||
}
|
||||
body, err := io.ReadAll(io.LimitReader(resp.Body, 256*1024)) // 256KB limit
|
||||
if err != nil { return }
|
||||
var t map[string]interface{}
|
||||
|
||||
Reference in New Issue
Block a user