Skip to content

Commit

Permalink
fix: use update interval parameter instead of fixed interval in comma…
Browse files Browse the repository at this point in the history
…nd group
  • Loading branch information
hiddify-com committed Feb 6, 2024
1 parent 4e1b536 commit ba808f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion experimental/libbox/command_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ func (c *CommandClient) handleGroupConn(conn net.Conn) {

func (s *CommandServer) handleGroupConn(conn net.Conn, onlyGroupItems bool) error {
defer conn.Close()
var interval int64
err := binary.Read(conn, binary.BigEndian, &interval)
if err != nil {
return E.Cause(err, "read interval")
}
ticker := time.NewTicker(time.Duration(interval))
defer ticker.Stop()
ctx := connKeepAlive(conn)
for {
service := s.service
Expand All @@ -76,7 +83,7 @@ func (s *CommandServer) handleGroupConn(conn net.Conn, onlyGroupItems bool) erro
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(2 * time.Second):
case <-ticker.C:
}
select {
case <-ctx.Done():
Expand Down

0 comments on commit ba808f2

Please sign in to comment.