Skip to content

Commit 5b47d0b

Browse files
committed
fixing async issue in asp.net.
1 parent 2a0b7be commit 5b47d0b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/MongoDB.Driver.Core/Core/Clusters/MultiServerCluster.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public override void Initialize()
108108
}
109109

110110
var stopwatch = Stopwatch.StartNew();
111-
MonitorServers();
111+
MonitorServers().ConfigureAwait(false);
112112
// We lock here even though AddServer locks. Monitors
113113
// are re-entrant such that this won't cause problems,
114114
// but could prevent issues of conflicting reports
@@ -174,7 +174,7 @@ protected override void RequestHeartbeat()
174174
}
175175
}
176176

177-
private async void MonitorServers()
177+
private async Task MonitorServers()
178178
{
179179
var monitorServersCancellationToken = _monitorServersCancellationTokenSource.Token;
180180
while (!monitorServersCancellationToken.IsCancellationRequested)

src/MongoDB.Driver.Core/Core/ConnectionPools/ExclusiveConnectionPool.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public void Initialize()
249249
_listener.ConnectionPoolBeforeOpening(new ConnectionPoolBeforeOpeningEvent(_serverId, _settings));
250250
}
251251

252-
MaintainSize();
252+
MaintainSize().ConfigureAwait(false);
253253

254254
if (_listener != null)
255255
{
@@ -279,7 +279,7 @@ public void Dispose()
279279
}
280280
}
281281

282-
private async void MaintainSize()
282+
private async Task MaintainSize()
283283
{
284284
var maintenanceCancellationToken = _maintenanceCancellationTokenSource.Token;
285285
while (!maintenanceCancellationToken.IsCancellationRequested)

src/MongoDB.Driver.Core/Core/Connections/BinaryConnection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ private async Task OpenAsyncHelper(CancellationToken cancellationToken)
234234
}
235235
}
236236

237-
private async void ReceiveBackgroundTask()
237+
private async Task ReceiveBackgroundTask()
238238
{
239239
while (!_backgroundTaskCancellationToken.IsCancellationRequested)
240240
{
@@ -306,7 +306,7 @@ public async Task<ReplyMessage<TDocument>> ReceiveMessageAsync<TDocument>(
306306
}
307307
}
308308

309-
private async void SendBackgroundTask()
309+
private async Task SendBackgroundTask()
310310
{
311311
while (!_backgroundTaskCancellationToken.IsCancellationRequested)
312312
{
@@ -411,8 +411,8 @@ public async Task SendMessagesAsync(IEnumerable<RequestMessage> messages, Messag
411411

412412
private void StartBackgroundTasks()
413413
{
414-
SendBackgroundTask();
415-
ReceiveBackgroundTask();
414+
SendBackgroundTask().ConfigureAwait(false);
415+
ReceiveBackgroundTask().ConfigureAwait(false);
416416
}
417417

418418
private void ThrowIfDisposed()

src/MongoDB.Driver.Core/Core/Servers/ClusterableServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void Initialize()
129129

130130
var stopwatch = Stopwatch.StartNew();
131131
_connectionPool.Initialize();
132-
MonitorServer();
132+
MonitorServer().ConfigureAwait(false);
133133
stopwatch.Stop();
134134

135135
if (_listener != null)
@@ -204,7 +204,7 @@ public async Task<IChannelHandle> GetChannelAsync(CancellationToken cancellation
204204
}
205205
}
206206

207-
private async void MonitorServer()
207+
private async Task MonitorServer()
208208
{
209209
var metronome = new Metronome(_settings.HeartbeatInterval);
210210
var heartbeatCancellationToken = _heartbeatCancellationTokenSource.Token;

0 commit comments

Comments
 (0)