Skip to content

Commit

Permalink
fix(ci): write version into xds first (#9274)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulbird committed Apr 10, 2023
1 parent 478104f commit 8476d78
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions t/xds-library/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import "C"
import (
"context"
"fmt"
"math/rand"
"strconv"
"time"
"unsafe"
Expand Down Expand Up @@ -84,7 +83,7 @@ func write_config(config_zone unsafe.Pointer, version_zone unsafe.Pointer) {
"create_time": 1646972532,
"uri": "/hello1",
"priority": 0,
"id": "1",
"id": "2",
"upstream_id": "1"
}`)

Expand All @@ -95,17 +94,21 @@ func write_config(config_zone unsafe.Pointer, version_zone unsafe.Pointer) {

}

func get_version() string {
return strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
}

func update_conf_version(zone unsafe.Pointer) {
ctx := context.Background()
key := "version"
write_shdict(key, get_version(), zone)
go func() {
for {
select {
case <-ctx.Done():
return
case <-time.After(time.Second * time.Duration(rand.Intn(10))):
key := "version"
version := strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
write_shdict(key, version, zone)
case <-time.After(time.Second * 5):
write_shdict("version", get_version(), zone)
}
}
}()
Expand Down

0 comments on commit 8476d78

Please sign in to comment.