public override async Task ConfigUpdatedAsync(BucketConfig newConfig) { if (newConfig.Name == Name && newConfig.IsNewerThan(CurrentConfig)) { CurrentConfig = newConfig; KeyMapper = _ketamaKeyMapperFactory.Create(CurrentConfig); if (CurrentConfig.ClusterNodesChanged) { await Context.ProcessClusterMapAsync(this, CurrentConfig).ConfigureAwait(false); } } }
public override async Task ConfigUpdatedAsync(BucketConfig newConfig) { if (newConfig.Name == Name && newConfig.IsNewerThan(CurrentConfig)) { if (Logger.IsEnabled(LogLevel.Debug)) { Logger.LogDebug("Processing cluster map for rev#{revision} on {bucketName} - old rev#{oldRevision}", newConfig.Rev, Name, CurrentConfig?.Rev); Logger.LogDebug(JsonSerializer.Serialize(CurrentConfig, InternalSerializationContext.Default.BucketConfig !)); } CurrentConfig = newConfig; if (CurrentConfig.VBucketMapChanged) { Logger.LogDebug(LoggingEvents.ConfigEvent, "Updating VB key mapper for rev#{revision} on {bucketName}", newConfig.Rev, Name); KeyMapper = _vBucketKeyMapperFactory.Create(CurrentConfig); } if (CurrentConfig.ClusterNodesChanged) { Logger.LogDebug(LoggingEvents.ConfigEvent, "Updating cluster nodes for rev#{revision} on {bucketName}", newConfig.Rev, Name); await Context.ProcessClusterMapAsync(this, CurrentConfig).ConfigureAwait(false); var nodes = Context.GetNodes(Name); //update the local nodes collection lock (Nodes) { Nodes.Clear(); foreach (var clusterNode in nodes) { Nodes.Add(clusterNode); } } } } Logger.LogDebug("Current revision for {bucketName} is rev#{revision}", Name, CurrentConfig?.Rev); }