This is an automated email from the ASF dual-hosted git repository.

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 8476d78eb fix(ci): write version into xds first (#9274)
8476d78eb is described below

commit 8476d78ebb17dacae650e62a6e18d575e3cc710b
Author: soulbird <[email protected]>
AuthorDate: Mon Apr 10 21:58:05 2023 +0800

    fix(ci): write version into xds first (#9274)
---
 t/xds-library/main.go | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/t/xds-library/main.go b/t/xds-library/main.go
index 4327d8305..6ee3bb2ea 100644
--- a/t/xds-library/main.go
+++ b/t/xds-library/main.go
@@ -34,7 +34,6 @@ import "C"
 import (
        "context"
        "fmt"
-       "math/rand"
        "strconv"
        "time"
        "unsafe"
@@ -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"
 }`)
 
@@ -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)
                        }
                }
        }()

Reply via email to