case 4173
This commit is contained in:
@@ -1262,9 +1262,6 @@ namespace AyaNova.Biz
|
||||
//a little different than normal here because the built in getasync doesn't return
|
||||
//a full User object normally
|
||||
User o = null;
|
||||
//save a fetch if it's a delete
|
||||
if (job.SubType != JobSubType.Delete)
|
||||
o = await GetAsync(id, false);
|
||||
switch (job.SubType)
|
||||
{
|
||||
case JobSubType.TagAddAny:
|
||||
@@ -1273,6 +1270,7 @@ namespace AyaNova.Biz
|
||||
case JobSubType.TagRemove:
|
||||
case JobSubType.TagReplaceAny:
|
||||
case JobSubType.TagReplace:
|
||||
o = await GetAsync(id, false);
|
||||
SaveIt = TagBiz.ProcessBatchTagOperation(o.Tags, (string)jobData["tag"], jobData.ContainsKey("toTag") ? (string)jobData["toTag"] : null, job.SubType);
|
||||
break;
|
||||
case JobSubType.Delete:
|
||||
@@ -1282,6 +1280,23 @@ namespace AyaNova.Biz
|
||||
FailedObjectCount++;
|
||||
}
|
||||
break;
|
||||
case JobSubType.DirectSMTP:
|
||||
o = await ct.User.AsNoTracking().Include(o => o.UserOptions).FirstOrDefaultAsync(z => z.Id == id);
|
||||
if (o != null && o.Active && !string.IsNullOrWhiteSpace(o.UserOptions.EmailAddress))
|
||||
{
|
||||
IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer;
|
||||
try
|
||||
{
|
||||
await m.SendEmailAsync(o.UserOptions.EmailAddress, (string)jobData["subject"], (string)jobData["message"], ServerGlobalOpsSettingsCache.Notify, null, null, null);
|
||||
await Task.Delay(AyaNova.Util.ServerBootConfig.JOB_OBJECT_EMAIL_LOOP_DELAY);//a small delay to not overwhelm the mail server
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FailedObjectCount++;
|
||||
await NotifyEventHelper.AddOpsProblemEvent("SMTP direct message failed", ex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new System.ArgumentOutOfRangeException($"ProcessBatchJobAsync -> Invalid job Subtype{job.SubType}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user