feat(uid): uid use object id

This commit is contained in:
eson 2020-12-09 19:00:49 +08:00
parent 487ce31c4c
commit daaf0e420e

View File

@ -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)
}
}
}