Skip to content

Commit 9ddf36c

Browse files
Apply suggestions from code review
Co-authored-by: Lucas Pimentel <[email protected]>
1 parent d695d8a commit 9ddf36c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tracer/src/Datadog.Trace/Configuration/SettingsManager.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ internal class SettingsManager(
4040

4141
/// <summary>
4242
/// Subscribe to changes in <see cref="MutableSettings"/> and/or <see cref="ExporterSettings"/>.
43-
/// Called whenever these settings change. If the settings have already changed when <see cref="SubscribeToChanges"/>
44-
/// is called, <paramref name="callback"/> is invoked immediately with the latest configuration.
43+
/// <paramref name="callback"/> is called whenever these settings change. If the settings have already changed when <see cref="SubscribeToChanges"/>
44+
/// is called, <paramref name="callback"/> is synchronously invoked immediately with the latest configuration.
4545
/// Also note that calling <see cref="SubscribeToChanges"/> twice with the same callback
46-
/// will invoke the callback twice.
46+
/// will invoke the callback twice. Callbacks should complete quickly to avoid blocking other operations.
4747
/// </summary>
4848
/// <param name="callback">The method to invoke</param>
4949
/// <returns>An <see cref="IDisposable"/> that should be disposed to unsubscribe</returns>
@@ -160,10 +160,9 @@ private void NotifySubscribers(SettingChanges settings)
160160

161161
lock (_subscribers)
162162
{
163-
var subscribers = _subscribers;
164163
Volatile.Write(ref _latest, settings);
165164

166-
foreach (var subscriber in subscribers)
165+
foreach (var subscriber in _subscribers)
167166
{
168167
try
169168
{

0 commit comments

Comments
 (0)