From daaf0e420e1a1df82e53b38af7b03d339ce1ec2c Mon Sep 17 00:00:00 2001 From: eson Date: Wed, 9 Dec 2020 19:00:49 +0800 Subject: [PATCH] feat(uid): uid use object id --- collect.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/collect.go b/collect.go index 01272d4..6db8c97 100644 --- a/collect.go +++ b/collect.go @@ -7,7 +7,6 @@ import ( "time" "git.nonolive.co/eson.hsm/databoard-collect/database" - "github.com/google/uuid" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" ) @@ -45,14 +44,15 @@ func collectCopyCountLiveAnchors(cxt *WorkerContext) { } for cur.Next(context.TODO()) { - la := &database.LiveAnchorsCountPoint{} + // la := &database.LiveAnchorsCountPoint{} + la := &database.LiveAnchorsCountPointObjectID{} err = cur.Decode(la) if err != nil { panic(err) } c := &CountLiveAnchors{} - c.UID = uuid.New().String() + c.UID = la.ObjectID.String() c.IsCounted = 0 c.CreateAt = la.CreateAt @@ -64,6 +64,7 @@ func collectCopyCountLiveAnchors(cxt *WorkerContext) { _, err = db.T.CountLiveAnchors.Insert(c) if err != nil { log.Println(err) + ps.Wait(time.Second * 2) } } }