From 068e2351c520266cc52b5d2a2741a6be0865a3f2 Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Thu, 6 Feb 2025 14:06:18 +0800 Subject: [PATCH] fix(webconsole): avoid high cpu load --- pkg/webconsole/guac/tunnel.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/webconsole/guac/tunnel.go b/pkg/webconsole/guac/tunnel.go index a2d5a7e310b..d8a5fd4af30 100644 --- a/pkg/webconsole/guac/tunnel.go +++ b/pkg/webconsole/guac/tunnel.go @@ -18,6 +18,7 @@ import ( "fmt" "io" "net" + "time" "yunion.io/x/log" "yunion.io/x/pkg/errors" @@ -53,7 +54,7 @@ func (self *GuacamoleTunnel) ReadOne() (*Instruction, error) { return nil, InvalidInstruction } return instruct, nil - default: + case <-time.After(1 * time.Second): } } }