mirror of https://github.com/tikv/client-go.git
				
				
				
			region_cache: add ForceRefreshAllStores function (#1686)
Signed-off-by: guo-shaoge <shaoge1994@163.com>
This commit is contained in:
		
							parent
							
								
									b7e019d315
								
							
						
					
					
						commit
						6aca9d27d6
					
				| 
						 | 
					@ -756,6 +756,11 @@ func NewRegionCache(pdClient pd.Client, opt ...RegionCacheOpt) *RegionCache {
 | 
				
			||||||
	return c
 | 
						return c
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ForceRefreshAllStores get all stores from PD and refresh store cache.
 | 
				
			||||||
 | 
					func (c *RegionCache) ForceRefreshAllStores(ctx context.Context) {
 | 
				
			||||||
 | 
						refreshFullStoreList(ctx, c.stores)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Try to refresh full store list. Errors are ignored.
 | 
					// Try to refresh full store list. Errors are ignored.
 | 
				
			||||||
func refreshFullStoreList(ctx context.Context, stores storeCache) {
 | 
					func refreshFullStoreList(ctx context.Context, stores storeCache) {
 | 
				
			||||||
	storeList, err := stores.fetchAllStores(ctx)
 | 
						storeList, err := stores.fetchAllStores(ctx)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue