Added daily logging

This commit is contained in:
M66B 2023-06-04 15:46:56 +02:00
parent 84054cec23
commit 3fe43794a7
2 changed files with 14 additions and 3 deletions

View File

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

View File

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