From e228a71a57495b9e26a96dd6506042d812796dc0 Mon Sep 17 00:00:00 2001 From: eson Date: Thu, 10 Dec 2020 19:00:35 +0800 Subject: [PATCH] fix(code): condition error --- collect.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/collect.go b/collect.go index 5e1f7e2..d3ee4fa 100644 --- a/collect.go +++ b/collect.go @@ -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()