load only most recent of duplicate logs
This commit is contained in:
		
							parent
							
								
									f4bf73d2cc
								
							
						
					
					
						commit
						e143e541ec
					
				@ -89,8 +89,11 @@ func Run(runOpts *options.ServerConfig) {
 | 
				
			|||||||
	for i := range oldJobs {
 | 
						for i := range oldJobs {
 | 
				
			||||||
		job := oldJobs[i]
 | 
							job := oldJobs[i]
 | 
				
			||||||
		job.ID = string(job.GitRef.GetRevID())
 | 
							job.ID = string(job.GitRef.GetRevID())
 | 
				
			||||||
 | 
							val, ok := Recents.Load(job.GitRef.GetRevID())
 | 
				
			||||||
 | 
							if !ok || val.(*Job).GitRef.Timestamp.Sub(job.GitRef.Timestamp) < 0 {
 | 
				
			||||||
			Recents.Store(job.GitRef.GetRevID(), job)
 | 
								Recents.Store(job.GitRef.GetRevID(), job)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ticker := time.NewTicker(runOpts.StaleJobAge / 2)
 | 
						ticker := time.NewTicker(runOpts.StaleJobAge / 2)
 | 
				
			||||||
	for {
 | 
						for {
 | 
				
			||||||
@ -209,6 +212,7 @@ func SetReport(urlRefID webhooks.URLSafeRefID, result *Result) error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	job := value.(*Job)
 | 
						job := value.(*Job)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// needs mutex (prevent double update)
 | 
				
			||||||
	job.Report = result
 | 
						job.Report = result
 | 
				
			||||||
	Actives.Store(refID, job)
 | 
						Actives.Store(refID, job)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user