Skip to content

Commit

Permalink
fix:block under multiple listeners to re-listen nacos-group#300 nacos…
Browse files Browse the repository at this point in the history
  • Loading branch information
Memoyu committed Aug 10, 2024
1 parent e6cf34b commit 8ac9b6b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ protected async override Task ExecuteConfigListen()
}

if (hasChangedKeys)
await NotifyListenConfig().ConfigureAwait(false);
await NotifyListenConfig().ConfigureAwait(false);
}

private async Task RefreshContentAndCheck(string groupKey, bool notify)
Expand Down Expand Up @@ -501,8 +501,13 @@ private void RemoveCache(string dataId, string group, string tenant)

protected override Task NotifyListenConfig()
{
_listenExecutebell.Add(_bellItem);
return Task.CompletedTask;
return Task.Factory.StartNew(async () =>
{
while (!_listenExecutebell.TryAdd(_bellItem))
{
await Task.Delay(500).ConfigureAwait(false);
}
});
}
}
}

0 comments on commit 8ac9b6b

Please sign in to comment.