Skip to content

Commit

Permalink
fixed #8722
Browse files Browse the repository at this point in the history
fixed #8722
  • Loading branch information
453873 authored and ReubenBond committed Nov 30, 2023
1 parent aafe70c commit 7fe9e6f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
Expand Down Expand Up @@ -28,6 +29,7 @@ internal class ClientClusterManifestProvider : IClusterManifestProvider, IAsyncD
private readonly CancellationTokenSource _cancellation = new CancellationTokenSource();
private ClusterManifest _current;
private Task _runTask;
private ConcurrentDictionary<SiloAddress, MajorMinorVersion> siloAddressVersionMap = new ConcurrentDictionary<SiloAddress, MajorMinorVersion>();

public ClientClusterManifestProvider(
IServiceProvider services,
Expand Down Expand Up @@ -79,7 +81,12 @@ private async Task RunAsync()
try
{
var provider = grainFactory.GetGrain<IClusterManifestSystemTarget>(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))
Expand All @@ -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))
{
Expand Down

0 comments on commit 7fe9e6f

Please sign in to comment.