Browse Source
Skip `WebSocketRequest` in `MvcCachedApplicationConfigurationClient`.
pull/10641/head
maliming
5 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
1 changed files with
6 additions and
4 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs
|
|
|
@ -45,21 +45,23 @@ namespace Volo.Abp.AspNetCore.Mvc.Client |
|
|
|
var cacheKey = CreateCacheKey(); |
|
|
|
var httpContext = HttpContextAccessor?.HttpContext; |
|
|
|
|
|
|
|
if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration) |
|
|
|
if (httpContext != null && !httpContext.WebSockets.IsWebSocketRequest && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration) |
|
|
|
{ |
|
|
|
|
|
|
|
return configuration; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
configuration = await Cache.GetOrAddAsync( |
|
|
|
cacheKey, |
|
|
|
async () => await ApplicationConfigurationAppService.GetAsync(), |
|
|
|
() => new DistributedCacheEntryOptions |
|
|
|
{ |
|
|
|
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300) //TODO: Should be configurable.
|
|
|
|
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(30) //TODO: Should be configurable.
|
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
if (httpContext != null) |
|
|
|
if (httpContext != null && !httpContext.WebSockets.IsWebSocketRequest) |
|
|
|
{ |
|
|
|
httpContext.Items[cacheKey] = configuration; |
|
|
|
} |
|
|
|
@ -72,7 +74,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client |
|
|
|
var cacheKey = CreateCacheKey(); |
|
|
|
var httpContext = HttpContextAccessor?.HttpContext; |
|
|
|
|
|
|
|
if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration) |
|
|
|
if (httpContext != null && !httpContext.WebSockets.IsWebSocketRequest && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration) |
|
|
|
{ |
|
|
|
return configuration; |
|
|
|
} |
|
|
|
|