Added daily logging

pull/212/head
M66B 1 year ago
parent 84054cec23
commit 3fe43794a7

@ -2938,6 +2938,7 @@ class Core {
long id = jargs.getLong(0); long id = jargs.getLong(0);
if (id < 0) { if (id < 0) {
EntityLog.log(context, "Executing deferred daily rules for message=" + message.id);
List<EntityRule> rules = db.rule().getEnabledRules(message.folder, true); List<EntityRule> rules = db.rule().getEnabledRules(message.folder, true);
EntityRule.run(context, rules, message, null, null); EntityRule.run(context, rules, message, null, null);
} else { } else {

@ -70,13 +70,20 @@ public class WorkerDailyRules extends Worker {
for (EntityAccount account : accounts) { for (EntityAccount account : accounts) {
List<EntityFolder> folders = db.folder().getFolders(account.id, false, false); List<EntityFolder> folders = db.folder().getFolders(account.id, false, false);
for (EntityFolder folder : folders) { for (EntityFolder folder : folders) {
EntityLog.log(context, "Executing daily rules for " + account.name + "/" + folder.name);
List<EntityRule> rules = db.rule().getEnabledRules(folder.id, true); List<EntityRule> rules = db.rule().getEnabledRules(folder.id, true);
if (rules.size() == 0) if (rules == null || rules.size() == 0)
continue; continue;
EntityLog.log(context, "Executing daily rules count=" + rules.size());
int count = 0; int count = 0;
List<Long> mids = db.message().getMessageIdsByFolder(folder.id); List<Long> ids = db.message().getMessageIdsByFolder(folder.id);
for (long mid : mids) if (ids == null || ids.size() == 0)
continue;
EntityLog.log(context, "Executing daily rules messages=" + ids.size());
for (long mid : ids)
try { try {
db.beginTransaction(); db.beginTransaction();
@ -91,11 +98,13 @@ public class WorkerDailyRules extends Worker {
if (needsHeaders && message.headers == null) { if (needsHeaders && message.headers == null) {
defer = true; defer = true;
EntityLog.log(context, "Deferring daily rules for headers message=" + message.id);
EntityOperation.queue(context, message, EntityOperation.HEADERS); EntityOperation.queue(context, message, EntityOperation.HEADERS);
} }
if (needsBody && !message.content) { if (needsBody && !message.content) {
defer = true; defer = true;
EntityLog.log(context, "Deferring daily rules for body message=" + message.id);
EntityOperation.queue(context, message, EntityOperation.BODY); EntityOperation.queue(context, message, EntityOperation.BODY);
} }
@ -104,6 +113,7 @@ public class WorkerDailyRules extends Worker {
continue; continue;
} }
EntityLog.log(context, "Executing daily rules message=" + message.id);
EntityRule.run(context, rules, message, null, null); EntityRule.run(context, rules, message, null, null);
db.setTransactionSuccessful(); db.setTransactionSuccessful();

Loading…
Cancel
Save