mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 09:48:32 +02:00
refactor: modernize code with go fix
This commit is contained in:
@@ -33,11 +33,7 @@ func (p *Poller[T, AggregateT]) ServeHTTP(c *gin.Context) {
|
||||
query := c.Request.URL.Query()
|
||||
|
||||
if httpheaders.IsWebsocket(c.Request.Header) {
|
||||
interval := metricsutils.QueryDuration(query, "interval", 0)
|
||||
|
||||
if interval < PollInterval {
|
||||
interval = PollInterval
|
||||
}
|
||||
interval := max(metricsutils.QueryDuration(query, "interval", 0), PollInterval)
|
||||
websocket.PeriodicWrite(c, interval, func() (any, error) {
|
||||
return p.GetRespData(period, query)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user