|
@@ -30,6 +30,7 @@ type Match struct {
|
|
|
RelationProjectPoolSize int
|
|
|
LoadProjectPoolSize int
|
|
|
ProjectBatch int
|
|
|
+ RelationProjectLimit int
|
|
|
Mgo_Log *MongodbSim
|
|
|
AllProject *sync.Map
|
|
|
Unique string
|
|
@@ -54,15 +55,16 @@ func (m *Match) Execute(projectMatcher ProjectMatcher, projectUser *map[*UserInf
|
|
|
<-userPool
|
|
|
userWaitGroup.Done()
|
|
|
}()
|
|
|
- newIds := []string{}
|
|
|
unique := projectMatcher.Unique(u)
|
|
|
- needLength := int64(RelationProjectLimit - len((*myMatchId)[unique]))
|
|
|
+ needLength := int64(m.RelationProjectLimit - len((*myMatchId)[unique]))
|
|
|
+ if needLength <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ newIds := []string{}
|
|
|
searchWaitGroup := &sync.WaitGroup{}
|
|
|
for _, _id := range *_ids {
|
|
|
- if (*myMatchId)[unique] == nil || !(*myMatchId)[unique][_id] {
|
|
|
- if surplus := atomic.AddInt64(&needLength, -1); surplus <= 0 {
|
|
|
- continue
|
|
|
- }
|
|
|
+ if surplus := atomic.AddInt64(&needLength, -1); surplus < 0 {
|
|
|
+ continue
|
|
|
}
|
|
|
if _, ok := m.AllProject.Load(_id); ok {
|
|
|
continue
|