From 87f729bae3b8036b670130c87ec3c3edde5a9062 Mon Sep 17 00:00:00 2001 From: yitter Date: Thu, 15 Apr 2021 14:33:57 +0800 Subject: [PATCH] auto commit --- Go/source/main.go | 5 +++-- README.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Go/source/main.go b/Go/source/main.go index e18dd42..34b4d37 100644 --- a/Go/source/main.go +++ b/Go/source/main.go @@ -30,7 +30,7 @@ func RegisterOne(ip *C.char, port int32, password *C.char, maxWorkerId int32) in func RegisterMany(ip *C.char, port int32, password *C.char, maxWorkerId int32, totalCount int32) []int32 { //values := regworkerid.RegisterMany(C.GoString(ip), port, C.GoString(password), maxWorkerId, totalCount) //return (*C.int)(unsafe.Pointer(&values)) - return regworkerid.RegisterMany(C.GoString(ip), port, C.GoString(password), maxWorkerId, totalCount); + return regworkerid.RegisterMany(C.GoString(ip), port, C.GoString(password), maxWorkerId, totalCount) } // 注销本机已注册的 WorkerId @@ -61,7 +61,8 @@ func main() { var begin = time.Now().UnixNano() / 1e3 for i := 0; i < genCount; i++ { // 生成ID - idgen.NextId() + id := idgen.NextId() + fmt.Println(id) } var end = time.Now().UnixNano() / 1e3 diff --git a/README.md b/README.md index bf1557a..e236f0e 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ extern GoInt32 Validate(GoInt32 workerId); ## 为什么不用大厂的? -❄ 首先,大厂们不但自己用雪花ID,而且还开源:[百度][81] | [美团][82] | [滴滴][83] | Sony[84] | [雪花ID鼻祖-推特][80]。 +❄ 首先,大厂们不但自己用雪花ID,而且还开源:[百度][81] | [美团][82] | [滴滴][83] | [Sony][84] | [雪花ID鼻祖-推特][80]。 ❄ 然而,大厂的雪花算法分为“经典算法”和“号段算法”两种,其中“号段算法”依赖网络或外部存储系统,不适合“非大厂”,且存在无法反应业务时序的缺点。