mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 16:01:32 +01:00 
			
		
		
		
	refactor api issues load attributes for better performance (#1066)
This commit is contained in:
		
							parent
							
								
									ab462fb95f
								
							
						
					
					
						commit
						a5ac4c64fc
					
				| @ -40,13 +40,14 @@ func ListIssues(ctx *context.APIContext) { | ||||
| 		issues = append(issues, tempIssues...) | ||||
| 	} | ||||
| 
 | ||||
| 	// FIXME: use IssueList to improve performance. | ||||
| 	err = models.IssueList(issues).LoadAttributes() | ||||
| 	if err != nil { | ||||
| 		ctx.Error(500, "LoadAttributes", err) | ||||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	apiIssues := make([]*api.Issue, len(issues)) | ||||
| 	for i := range issues { | ||||
| 		if err = issues[i].LoadAttributes(); err != nil { | ||||
| 			ctx.Error(500, "LoadAttributes", err) | ||||
| 			return | ||||
| 		} | ||||
| 		apiIssues[i] = issues[i].APIFormat() | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user