diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2026-02-15 00:49:19 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2026-02-15 00:49:19 +0300 |
| commit | 5b796672e90934b34186b0a6809857c417304f5f (patch) | |
| tree | 3b89995606b86bb29cd13228212a237c96f923bf /web/service/inbound.go | |
| parent | 3fa0da38c9bde8f86bf6fd885371628808bd8555 (diff) | |
Improve telego client robustness and retries
Add a createRobustFastHTTPClient helper to configure fasthttp.Client with better timeouts, connection limits, retries and optional SOCKS5 proxy dialing. Validate and sanitize proxy and API server URLs instead of returning early on invalid values, and build telego.Bot options dynamically. Reduce long-polling timeout to detect connection issues faster and adjust update retrieval comments. Implement exponential-backoff retry logic for SendMessage calls to handle transient connection/timeouts and improve delivery reliability; also reduce inter-message delay for better throughput.
Diffstat (limited to 'web/service/inbound.go')
| -rw-r--r-- | web/service/inbound.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go index ec51bc27..101c79d9 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -2141,25 +2141,25 @@ func (s *InboundService) GetInboundClientIps(clientEmail string) (string, error) if err != nil { return "", err } - + if InboundClientIps.Ips == "" { return "", nil } - + // Try to parse as new format (with timestamps) type IPWithTimestamp struct { IP string `json:"ip"` Timestamp int64 `json:"timestamp"` } - + var ipsWithTime []IPWithTimestamp err = json.Unmarshal([]byte(InboundClientIps.Ips), &ipsWithTime) - + // If successfully parsed as new format, return with timestamps if err == nil && len(ipsWithTime) > 0 { return InboundClientIps.Ips, nil } - + // Otherwise, assume it's old format (simple string array) // Try to parse as simple array and convert to new format var oldIps []string @@ -2176,7 +2176,7 @@ func (s *InboundService) GetInboundClientIps(clientEmail string) (string, error) result, _ := json.Marshal(newIpsWithTime) return string(result), nil } - + // Return as-is if parsing fails return InboundClientIps.Ips, nil } |
