Skip to content

Commit dd63957

Browse files
compute ping rate
Signed-off-by: eternal-flame-AD <[email protected]>
1 parent 11e6d50 commit dd63957

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

v2/shim_v1.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ type GrpcDialer interface {
3939

4040
var (
4141
httpTimeout = 10 * time.Second
42+
pingRate = 4 * time.Second
4243
)
4344

4445
func init() {
4546
if testing.Testing() {
4647
httpTimeout = 100 * time.Millisecond
48+
pingRate = 10 * time.Millisecond
4749
}
4850
}
4951

@@ -545,12 +547,7 @@ func (s *compatV1ShimServer) RunUserInstance(req *protobuf.UserInstanceRequest,
545547
s.shim.mu.Unlock()
546548
})
547549

548-
ticker := time.NewTicker(15 * time.Second)
549-
550-
if testing.Testing() {
551-
ticker.Stop()
552-
ticker = time.NewTicker(5 * time.Millisecond)
553-
}
550+
ticker := time.NewTicker(pingRate)
554551

555552
defer ticker.Stop()
556553
for {

0 commit comments

Comments
 (0)