Notify: removed schedulers. Fixed send
This commit is contained in:
parent
667b10e874
commit
406ee9f2f9
@ -69,15 +69,19 @@ public class NotifyServiceCfg
|
||||
|
||||
}
|
||||
}
|
||||
foreach (var s in Schedulers)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.Init();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
if (Schedulers != null)
|
||||
{
|
||||
foreach (var s in Schedulers)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.Init();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user