Skip to content

Commit c4c8cec

Browse files
make ws retry interval configurable
1 parent 2e46675 commit c4c8cec

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

exec/ws/config.example.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ name = "debug-client"
77
retry = 10
88
# the key used in SHA256-HMAC authentication
99
key = "keyusedforhmac"
10+
# retry interval
11+
retry-interval = 10
1012

1113
# Set corresponding item to false if you don't want to enable some test
1214
[api]

exec/ws/config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package main
22

33
type ConfigConn struct {
4-
Remote string `toml:"remote"`
5-
Name string `toml:"name"`
6-
Key string `toml:"key"`
7-
Retry uint32 `toml:"retry"`
4+
Remote string `toml:"remote"`
5+
Name string `toml:"name"`
6+
Key string `toml:"key"`
7+
Retry uint32 `toml:"retry"`
8+
Interval uint64 `toml:"retry-interval"`
89
}
910

1011
type ConfigAPI struct {
@@ -24,6 +25,7 @@ func (r *Config) SetDefault() {
2425
r.Conn.Remote = "ws://127.0.0.1:8080"
2526
r.Conn.Name = "debug-client"
2627
r.Conn.Retry = 10
28+
r.Conn.Interval = 10
2729

2830
r.API.Resolve = true
2931
r.API.Ping = true

exec/ws/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ func main() {
327327
}
328328
icmp.GetICMPManager().Flush()
329329

330-
time.Sleep(time.Second)
330+
time.Sleep(time.Duration(config.Conn.Interval) * time.Second)
331331
}
332-
333332
}

0 commit comments

Comments
 (0)