Exemplo n.º 1
0
 protected override async Task ExecuteAsync(CancellationToken stoppingToken)
 {
     while (!stoppingToken.IsCancellationRequested)
     {
         //_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
         EmailNotifier.SysRecipients = AppContentDB.GetSourceRecipients(_configuration.GetConnectionString(DEFAULT_CONNECTION));
         DataList <Notification> notifs = ScheduleDB.GetNotifications(Notification.NotificationType.Email, 0 - (short)DateTimeOffset.Now.Offset.TotalMinutes, DateTime.Now.AddMilliseconds(-DelayMS), DateTime.Now.AddMilliseconds(DelayMS), 1, _configuration.GetConnectionString(DEFAULT_CONNECTION));
         Console.WriteLine(string.Concat(notifs.Data.Count, "notifications ready to send."));
         new NotificationProcessor <Notification>(notifs.Data, this).Start();
         Console.WriteLine("Sending notifications...");
         System.GC.Collect();
         await Task.Delay(DelayMS, stoppingToken);
     }
 }
 public IActionResult Notifications(long id, int tzOffset, DateTime?from = null, DateTime?to = null, int lang = 1, byte limit = 5)
 {
     return(Json(ScheduleDB.GetNotifications(id, NotificationType.Push, tzOffset, from, to, lang, limit, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION))));
 }