Browse Source

Merge pull request #6181 from abpframework/maliming/LockAsync

ConfigureAwait for SemaphoreSlim's LockAsync method.
pull/6195/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
5b57beaeab
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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. 2
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
  5. 4
      framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs
  6. 2
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs
  7. 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))
{ {

2
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs

@ -499,7 +499,7 @@ namespace Volo.Abp.Caching
return value; return value;
} }
using (await SyncSemaphore.LockAsync(token)) using (await SyncSemaphore.LockAsync(token).ConfigureAwait(false))
{ {
value = await GetAsync(key, hideErrors, considerUow, token); value = await GetAsync(key, hideErrors, considerUow, token);
if (value != null) if (value != null)

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
} }
} }
} }
} }

2
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs

@ -27,7 +27,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
string baseUrl, string baseUrl,
Func<Task<ApplicationApiDescriptionModel>> factory) Func<Task<ApplicationApiDescriptionModel>> factory)
{ {
using (await _semaphore.LockAsync(CancellationTokenProvider.Token)) using (await _semaphore.LockAsync(CancellationTokenProvider.Token).ConfigureAwait(false))
{ {
var model = _cache.GetOrDefault(baseUrl); var model = _cache.GetOrDefault(baseUrl);
if (model == null) if (model == null)

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