fix(code): condition error

This commit is contained in:
eson 2020-12-10 19:00:35 +08:00
parent e9862571e2
commit e228a71a57

View File

@ -17,7 +17,7 @@ func collectCopyCountLiveAnchors(cxt *WorkerContext) {
var err error
var ok bool
var lastLiveAnchor *CountLiveAnchors
for !ps.IsClose() {
liveanchor := &CountLiveAnchors{}
@ -33,17 +33,8 @@ func collectCopyCountLiveAnchors(cxt *WorkerContext) {
}
cur, err = mdb.C.CountLiveAnchors.Find(context.TODO(), bson.M{"create_at": bson.M{"$gt": last}})
} else {
if lastLiveAnchor != nil {
if liveanchor.UID == liveanchor.UID {
ps.Wait(time.Second * 2)
continue
}
}
last = liveanchor.CreateAt
log.Println("last: ", last, liveanchor.UID)
lastLiveAnchor = liveanchor
cur, err = mdb.C.CountLiveAnchors.Find(context.TODO(), bson.M{"create_at": bson.M{"$gt": last}})
}
@ -61,6 +52,7 @@ func collectCopyCountLiveAnchors(cxt *WorkerContext) {
if err != nil {
panic(err)
}
c := &CountLiveAnchors{}
c.UID = la.ObjectID.Hex()