mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-30 21:58:39 +00:00
WebSocket transport, XHTTP server: Reduce some goroutines by switching to task.Periodic (#7470)
https://github.com/XTLS/Xray-core/pull/7463#issuecomment-7081595080 https://github.com/XTLS/Xray-core/pull/7470#issuecomment-7131388265 https://github.com/XTLS/Xray-core/pull/7470#issuecomment-7163168321 --------- Co-authored-by: StarProxima <34741787+StarProxima@users.noreply.github.com>
This commit is contained in:
@@ -58,15 +58,11 @@ func (t *Periodic) Start() error {
|
||||
return nil
|
||||
}
|
||||
t.running = true
|
||||
t.timer = time.AfterFunc(t.Interval, func() {
|
||||
t.checkedExecute()
|
||||
})
|
||||
t.access.Unlock()
|
||||
|
||||
if err := t.checkedExecute(); err != nil {
|
||||
t.access.Lock()
|
||||
t.running = false
|
||||
t.access.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user