Browse Source

Fix rules cache duration parameter.

pull/927/head
Sebastian 4 years ago
parent
commit
98ab7e9c6e
  1. 2
      backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleOptions.cs
  2. 7
      backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs
  3. 1
      backend/tests/docker-compose.yml

2
backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleOptions.cs

@ -11,6 +11,6 @@ namespace Squidex.Domain.Apps.Core.HandleRules
{
public int ExecutionTimeoutInSeconds { get; set; } = 3;
public TimeSpan RuleCacheDuration { get; set; } = TimeSpan.FromSeconds(10);
public TimeSpan RulesCacheDuration { get; set; } = TimeSpan.FromSeconds(10);
}
}

7
backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs

@ -42,7 +42,7 @@ namespace Squidex.Domain.Apps.Entities.Rules
{
this.appProvider = appProvider;
this.cache = cache;
this.cacheDuration = options.Value.RuleCacheDuration;
this.cacheDuration = options.Value.RulesCacheDuration;
this.ruleEventRepository = ruleEventRepository;
this.ruleService = ruleService;
this.log = log;
@ -98,6 +98,11 @@ namespace Squidex.Domain.Apps.Entities.Rules
private Task<List<IRuleEntity>> GetRulesAsync(DomainId appId)
{
if (cacheDuration <= TimeSpan.Zero || cacheDuration == TimeSpan.MaxValue)
{
return appProvider.GetRulesAsync(appId);
}
var cacheKey = $"{typeof(RuleEnqueuer)}_Rules_{appId}";
// Cache the rules for performance reasons for a short period of time (usually 10 sec).

1
backend/tests/docker-compose.yml

@ -44,6 +44,7 @@ services:
- IDENTITY__ADMINCLIENTID=root
- IDENTITY__ADMINCLIENTSECRET=xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0=
- IDENTITY__MULTIPLEDOMAINS=true
- RULES__RULESCACHEDURATION=00:00:00
- SCRIPTING__TIMEOUTEXECUTION=00:00:10
- SCRIPTING__TIMEOUTSCRIPT=00:00:10
- STORE__MONGODB__CONFIGURATION=mongodb://mongo

Loading…
Cancel
Save