Notify: removed schedulers. Fixed send

This commit is contained in:
pavelbannov 2023-01-19 23:13:29 +03:00
parent 667b10e874
commit 406ee9f2f9
4 changed files with 16 additions and 29 deletions

View File

@ -69,6 +69,9 @@ public class NotifyServiceCfg
}
}
if (Schedulers != null)
{
foreach (var s in Schedulers)
{
try
@ -81,6 +84,7 @@ public class NotifyServiceCfg
}
}
}
}
}
public class NotifyServiceCfgProcess

View File

@ -163,12 +163,13 @@ public class DbWorker
{
using var scope = _serviceScopeFactory.CreateScope();
using var dbContext = scope.ServiceProvider.GetService<IDbContextFactory<NotifyDbContext>>().CreateDbContext();
using var tx = dbContext.Database.BeginTransaction();
var strategy = dbContext.Database.CreateExecutionStrategy();
strategy.Execute(() =>
{
using var scope = _serviceScopeFactory.CreateScope();
using var dbContext = scope.ServiceProvider.GetService<IDbContextFactory<NotifyDbContext>>().CreateDbContext();
using var tx = dbContext.Database.BeginTransaction();
if (result == MailSendingState.Sended)
{
var d = dbContext.NotifyInfo.Where(r => r.NotifyId == id).FirstOrDefault();

View File

@ -55,7 +55,7 @@ public class NotifySenderService : BackgroundService
stoppingToken.Register(() => _logger.Debug("NotifySenderService background task is stopping."));
if (0 < _notifyServiceCfg.Schedulers.Count)
if (_notifyServiceCfg.Schedulers != null && _notifyServiceCfg.Schedulers.Any())
{
InitializeNotifySchedulers();
}

View File

@ -21,24 +21,6 @@
"useCoreSettings" : "true"
}
}
],
"schedulers": [
{
"name": "Calendar",
"register": "ASC.Api.Calendar.Notification.CalendarNotifyClient.RegisterSendMethod, ASC.Api.Calendar"
},
{
"name": "Projects",
"register": "ASC.Web.Projects.Configuration.ProductEntryPoint.RegisterSendMethods, ASC.Web.Projects"
},
{
"name": "Birthdays",
"register": "ASC.Web.Community.Birthdays.BirthdaysModule.RegisterSendMethod, ASC.Web.Community"
},
{
"name": "CRM",
"register": "ASC.Web.CRM.Configuration.ProductEntryPoint.RegisterSendMethods, ASC.Web.CRM"
}
]
}
}