forked from gongxuegit/tiku-backend.net
perf: optimize authorization scoreline and workers
This commit is contained in:
@@ -121,6 +121,8 @@ internal sealed class PlatformBillingAdminService(
|
||||
Details = JsonSerializer.SerializeToElement(new { item.FeatureCode, item.Mode, item.ExpiresAt, item.Reason })
|
||||
});
|
||||
await db.SaveChangesAsync(token);
|
||||
await services.GetRequiredService<ITenantFeatureCacheInvalidator>()
|
||||
.InvalidateAsync(command.TenantId, token);
|
||||
await services.GetRequiredService<ISecurityEventPublisher>().CapabilityChangedAsync(
|
||||
command.TenantId,
|
||||
featureCode,
|
||||
|
||||
@@ -13,7 +13,8 @@ namespace Tiku.Infrastructure.PlatformBilling;
|
||||
|
||||
internal sealed class PlatformBillingSettlementService(
|
||||
TikuDbContext dbContext,
|
||||
ISecurityEventPublisher securityEventPublisher) : IPlatformBillingSettlementService
|
||||
ISecurityEventPublisher securityEventPublisher,
|
||||
ITenantFeatureCacheInvalidator featureCacheInvalidator) : IPlatformBillingSettlementService
|
||||
{
|
||||
public async Task<PlatformBillingPayment> MarkPaidAsync(
|
||||
Guid paymentId,
|
||||
@@ -201,6 +202,7 @@ internal sealed class PlatformBillingSettlementService(
|
||||
Details = JsonSerializer.SerializeToElement(new { order.OrderNo, payment.PaymentNo, payment.Provider, order.Purpose })
|
||||
});
|
||||
await dbContext.SaveChangesAsync(cancellationToken);
|
||||
await featureCacheInvalidator.InvalidateAsync(order.TenantId, cancellationToken);
|
||||
|
||||
var newFeatures = await LoadSubscriptionFeaturesAsync(subscription, cancellationToken);
|
||||
var changedFeatures = oldFeatures.Concat(newFeatures).Distinct(StringComparer.Ordinal).ToArray();
|
||||
|
||||
@@ -206,6 +206,9 @@ internal sealed class SaasSubscriptionLifecycleService(
|
||||
return false;
|
||||
}
|
||||
|
||||
await services.GetRequiredService<ITenantFeatureCacheInvalidator>()
|
||||
.InvalidateAsync(tenantId, cancellationToken);
|
||||
|
||||
var newFeatures = await LoadFeaturesAsync(dbContext, subscription, cancellationToken);
|
||||
var changedFeatures = oldFeatures.Concat(newFeatures).Distinct(StringComparer.Ordinal).ToArray();
|
||||
var eventPublisher = services.GetRequiredService<ISecurityEventPublisher>();
|
||||
@@ -221,7 +224,8 @@ internal sealed class SaasSubscriptionLifecycleService(
|
||||
correlationId,
|
||||
cancellationToken);
|
||||
}
|
||||
services.GetRequiredService<ITenantRuntimeCacheInvalidator>().Invalidate(tenantId);
|
||||
await services.GetRequiredService<ITenantRuntimeCacheInvalidator>()
|
||||
.InvalidateAsync(tenantId, cancellationToken);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user