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()