Merge pull request #660 from sbwalker/master
optimize NotificationJob so that it only processes the sites for each tenant once.
This commit is contained in:
commit
679cc04178
@ -20,11 +20,15 @@ namespace Oqtane.Infrastructure
|
||||
{
|
||||
string log = "";
|
||||
|
||||
// iterate through aliases in this installation
|
||||
// iterate through tenants in this installation
|
||||
List<int> tenants = new List<int>();
|
||||
var aliasRepository = provider.GetRequiredService<IAliasRepository>();
|
||||
List<Alias> aliases = aliasRepository.GetAliases().ToList();
|
||||
foreach (Alias alias in aliases)
|
||||
{
|
||||
if (tenants.Contains(alias.TenantId)) continue;
|
||||
tenants.Add(alias.TenantId);
|
||||
|
||||
// use the SiteState to set the Alias explicitly so the tenant can be resolved
|
||||
var siteState = provider.GetRequiredService<SiteState>();
|
||||
siteState.Alias = alias;
|
||||
@ -34,7 +38,7 @@ namespace Oqtane.Infrastructure
|
||||
var settingRepository = provider.GetRequiredService<ISettingRepository>();
|
||||
var notificationRepository = provider.GetRequiredService<INotificationRepository>();
|
||||
|
||||
// iterate through sites
|
||||
// iterate through sites for this tenant
|
||||
List<Site> sites = siteRepository.GetSites().ToList();
|
||||
foreach (Site site in sites)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user