Browse Source

ConfigureAwait for SemaphoreSlim's LockAsync method..

Resolve #6180
pull/6181/head
maliming 6 years ago
parent
commit
30ee2a6044
  1. 4
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs
  2. 8
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs
  3. 2
      framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs
  4. 4
      framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs
  5. 4
      framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/VirtualFiles/LocalizedTemplateContentReaderFactory.cs

4
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.RequestLocalization
{ {
if (_requestLocalizationOptions == null) if (_requestLocalizationOptions == null)
{ {
using (await _syncSemaphore.LockAsync()) using (await _syncSemaphore.LockAsync().ConfigureAwait(false))
{ {
if (_requestLocalizationOptions == null) if (_requestLocalizationOptions == null)
{ {

8
framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs

@ -23,7 +23,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
protected JobQueueConfiguration QueueConfiguration { get; } protected JobQueueConfiguration QueueConfiguration { get; }
protected IChannelAccessor ChannelAccessor { get; private set; } protected IChannelAccessor ChannelAccessor { get; private set; }
protected EventingBasicConsumer Consumer { get; private set; } protected EventingBasicConsumer Consumer { get; private set; }
public ILogger<JobQueue<TArgs>> Logger { get; set; } public ILogger<JobQueue<TArgs>> Logger { get; set; }
protected AbpBackgroundJobOptions AbpBackgroundJobOptions { get; } protected AbpBackgroundJobOptions AbpBackgroundJobOptions { get; }
@ -76,7 +76,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
{ {
CheckDisposed(); CheckDisposed();
using (await SyncObj.LockAsync()) using (await SyncObj.LockAsync().ConfigureAwait(false))
{ {
await EnsureInitializedAsync(); await EnsureInitializedAsync();
@ -95,7 +95,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
return; return;
} }
using (await SyncObj.LockAsync()) using (await SyncObj.LockAsync().ConfigureAwait(false))
{ {
await EnsureInitializedAsync(); await EnsureInitializedAsync();
} }
@ -151,7 +151,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
} }
protected virtual Task PublishAsync( protected virtual Task PublishAsync(
TArgs args, TArgs args,
BackgroundJobPriority priority = BackgroundJobPriority.Normal, BackgroundJobPriority priority = BackgroundJobPriority.Normal,
TimeSpan? delay = null) TimeSpan? delay = null)
{ {

2
framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs

@ -64,7 +64,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ
return (IJobQueue<TArgs>)jobQueue; return (IJobQueue<TArgs>)jobQueue;
} }
using (await SyncSemaphore.LockAsync()) using (await SyncSemaphore.LockAsync().ConfigureAwait(false))
{ {
if (JobQueues.TryGetValue(jobConfiguration.JobName, out jobQueue)) if (JobQueues.TryGetValue(jobConfiguration.JobName, out jobQueue))
{ {

4
framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs

@ -21,7 +21,7 @@ namespace Volo.Abp.Threading
return; return;
} }
using (await _semaphore.LockAsync()) using (await _semaphore.LockAsync().ConfigureAwait(false))
{ {
if (_runBefore) if (_runBefore)
{ {
@ -34,4 +34,4 @@ namespace Volo.Abp.Threading
} }
} }
} }
} }

4
framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/VirtualFiles/LocalizedTemplateContentReaderFactory.cs

@ -27,7 +27,7 @@ namespace Volo.Abp.TextTemplating.VirtualFiles
return reader; return reader;
} }
using (await SyncObj.LockAsync()) using (await SyncObj.LockAsync().ConfigureAwait(false))
{ {
if (ReaderCache.TryGetValue(templateDefinition.Name, out reader)) if (ReaderCache.TryGetValue(templateDefinition.Name, out reader))
{ {
@ -69,4 +69,4 @@ namespace Volo.Abp.TextTemplating.VirtualFiles
} }
} }
} }
} }

Loading…
Cancel
Save