This commit is contained in:
2020-07-16 17:58:23 +00:00
parent 35bf96e5c0
commit 9f0944d37b
10 changed files with 50 additions and 54 deletions

View File

@@ -37,22 +37,30 @@ namespace AyaNova.Biz
await AddEvent(new NotifyEvent() { EventType = NotifyEventType.ServerOperationsProblem, Message = message });
}
public static async Task AddEvent(NotifyEvent ev)
//Add event if there are subscribers
public static async Task AddEvent(NotifyEvent ev, List<string> inTags = null)
{
log.LogTrace($"AddEvent processing: [{ev.ToString()}]");
try
{
log.LogTrace("Notify set to RUNNING state and starting now");
List<NotifySubscription> subs = new List<NotifySubscription>();
using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext)
{
//iterate subs, figure out who gets this event
//add to table for any that do
var subs=await ct.NotifySubscription.AsNoTracking().Where(z=>z.EventType==ev.EventType &&)
if (inTags == null || inTags.Count==0)
{
//No tags
subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == ev.EventType && z.AyaType == ev.AyaType).ToListAsync();
}
else
{
//In tags
}
}
}