querySubstitutablePaths(): Don't query paths for which we already have a substituter
This commit is contained in:
		
							parent
							
								
									0c85ef7090
								
							
						
					
					
						commit
						edf9eb8181
					
				
					 1 changed files with 16 additions and 3 deletions
				
			
		|  | @ -781,14 +781,27 @@ Path LocalStore::queryPathFromHashPart(const string & hashPart) | ||||||
| PathSet LocalStore::querySubstitutablePaths(const PathSet & paths) | PathSet LocalStore::querySubstitutablePaths(const PathSet & paths) | ||||||
| { | { | ||||||
|     if (!settings.useSubstitutes) return PathSet(); |     if (!settings.useSubstitutes) return PathSet(); | ||||||
|  | 
 | ||||||
|  |     auto remaining = paths; | ||||||
|     PathSet res; |     PathSet res; | ||||||
|  | 
 | ||||||
|     for (auto & sub : getDefaultSubstituters()) { |     for (auto & sub : getDefaultSubstituters()) { | ||||||
|         if (res.size() == paths.size()) break; |         if (remaining.empty()) break; | ||||||
|         if (sub->storeDir != storeDir) continue; |         if (sub->storeDir != storeDir) continue; | ||||||
|         if (!sub->wantMassQuery()) continue; |         if (!sub->wantMassQuery()) continue; | ||||||
|         for (auto path : sub->queryValidPaths(paths)) | 
 | ||||||
|  |         auto valid = sub->queryValidPaths(remaining); | ||||||
|  | 
 | ||||||
|  |         PathSet remaining2; | ||||||
|  |         for (auto & path : remaining) | ||||||
|  |             if (valid.count(path)) | ||||||
|                 res.insert(path); |                 res.insert(path); | ||||||
|  |             else | ||||||
|  |                 remaining2.insert(path); | ||||||
|  | 
 | ||||||
|  |         std::swap(remaining, remaining2); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     return res; |     return res; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue