From 8f49bd265e68c9984bbf74ce4bd4fbbaf0b0446a Mon Sep 17 00:00:00 2001 From: swam <453873@qq.com> Date: Sat, 18 Nov 2023 11:20:14 +0800 Subject: [PATCH] fixed #8722 fixed #8722 --- .../Manifest/ClientClusterManifestProvider.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs b/src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs index 925629350d..a991817f76 100644 --- a/src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs +++ b/src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; @@ -28,6 +29,7 @@ internal class ClientClusterManifestProvider : IClusterManifestProvider, IAsyncD private readonly CancellationTokenSource _cancellation = new CancellationTokenSource(); private ClusterManifest _current; private Task _runTask; + private ConcurrentDictionary siloAddressVersionMap = new ConcurrentDictionary(); public ClientClusterManifestProvider( IServiceProvider services, @@ -79,7 +81,12 @@ private async Task RunAsync() try { var provider = grainFactory.GetGrain(SystemTargetGrainId.Create(Constants.ManifestProviderType, gateway).GrainId); - var refreshTask = provider.GetClusterManifestIfNewer(_current.Version).AsTask(); + var currentVersion = _current.Version; + if (siloAddressVersionMap.ContainsKey(gateway)) + { + siloAddressVersionMap.TryGetValue(gateway, out currentVersion); + } + var refreshTask = provider.GetClusterManifestIfNewer(currentVersion).AsTask(); var task = await Task.WhenAny(cancellationTask, refreshTask).ConfigureAwait(false); if (ReferenceEquals(task, cancellationTask)) @@ -94,6 +101,7 @@ private async Task RunAsync() await Task.WhenAny(cancellationTask, Task.Delay(_typeManagementOptions.TypeMapRefreshInterval)); continue; } + siloAddressVersionMap[gateway] = updatedManifest.Version; if (!_updates.TryPublish(updatedManifest)) {