region_cache: add ForceRefreshAllStores function (#1686)

Signed-off-by: guo-shaoge <shaoge1994@163.com>
This commit is contained in:
guo-shaoge 2025-06-30 18:03:00 +08:00 committed by GitHub
parent b7e019d315
commit 6aca9d27d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -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)