mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Use IterateBufferSize whilst querying repositories during adoption check (#19140)
The adoption page checks directories to see if they are repositories by querying the db on a per user basis. This can lead to problems if a user has a large number of repositories or putative repositories. This PR changes the buffering to check the db in IterataeBufferSize batches instead. Fix #19137 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -339,6 +339,13 @@ func ListUnadoptedRepositories(query string, opts *db.ListOptions) ([]string, in
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		repoNamesToCheck = append(repoNamesToCheck, name)
 | 
							repoNamesToCheck = append(repoNamesToCheck, name)
 | 
				
			||||||
 | 
							if len(repoNamesToCheck) > setting.Database.IterateBufferSize {
 | 
				
			||||||
 | 
								if err = checkUnadoptedRepositories(userName, repoNamesToCheck, unadopted); err != nil {
 | 
				
			||||||
 | 
									return err
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								repoNamesToCheck = repoNamesToCheck[:0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return filepath.SkipDir
 | 
							return filepath.SkipDir
 | 
				
			||||||
	}); err != nil {
 | 
						}); err != nil {
 | 
				
			||||||
		return nil, 0, err
 | 
							return nil, 0, err
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user