mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
conditionally fresh the shard locations
This commit is contained in:
parent
47f1901843
commit
de1a35acdd
|
@ -210,7 +210,13 @@ func forgetShardId(ecVolume *erasure_coding.EcVolume, shardId erasure_coding.Sha
|
||||||
|
|
||||||
func (s *Store) cachedLookupEcShardLocations(ctx context.Context, ecVolume *erasure_coding.EcVolume) (err error) {
|
func (s *Store) cachedLookupEcShardLocations(ctx context.Context, ecVolume *erasure_coding.EcVolume) (err error) {
|
||||||
|
|
||||||
if ecVolume.ShardLocationsRefreshTime.Add(10 * time.Minute).After(time.Now()) {
|
shardCount := len(ecVolume.ShardLocations)
|
||||||
|
if shardCount < erasure_coding.DataShardsCount &&
|
||||||
|
ecVolume.ShardLocationsRefreshTime.Add(11 * time.Second).After(time.Now()) ||
|
||||||
|
shardCount == erasure_coding.TotalShardsCount &&
|
||||||
|
ecVolume.ShardLocationsRefreshTime.Add(37 * time.Minute).After(time.Now()) ||
|
||||||
|
shardCount >= erasure_coding.DataShardsCount &&
|
||||||
|
ecVolume.ShardLocationsRefreshTime.Add(7 * time.Minute).After(time.Now()) {
|
||||||
// still fresh
|
// still fresh
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue