Added operations to debug info

pull/194/merge
M66B 4 years ago
parent f82e503917
commit 6943a7a250

@ -118,6 +118,13 @@ public interface DaoOperation {
@Query("SELECT * FROM operation WHERE error IS NOT NULL") @Query("SELECT * FROM operation WHERE error IS NOT NULL")
List<EntityOperation> getOperationsError(); List<EntityOperation> getOperationsError();
@Query("SELECT COUNT(id) FROM operation")
int getOperationCount();
@Query("SELECT COUNT(id) FROM operation" +
" WHERE account = :account")
int getOperationCount(long account);
@Query("SELECT COUNT(id) FROM operation" + @Query("SELECT COUNT(id) FROM operation" +
" WHERE folder = :folder" + " WHERE folder = :folder" +
" AND (:name IS NULL OR name = :name)") " AND (:name IS NULL OR name = :name)")

@ -2045,6 +2045,7 @@ public class Log {
" folders=" + db.folder().countTotal() + " folders=" + db.folder().countTotal() +
" messages=" + db.message().countTotal() + " messages=" + db.message().countTotal() +
" rules=" + db.rule().countTotal() + " rules=" + db.rule().countTotal() +
" operations=" + db.operation().getOperationCount() +
"\r\n\r\n"); "\r\n\r\n");
if (schedule) { if (schedule) {
@ -2081,7 +2082,8 @@ public class Log {
" exempted=" + account.poll_exempted + " exempted=" + account.poll_exempted +
" poll=" + account.poll_interval + " poll=" + account.poll_interval +
" ondemand=" + account.ondemand + " ondemand=" + account.ondemand +
" messages=" + content + "/" + messages + " msgs=" + content + "/" + messages +
" ops=" + db.operation().getOperationCount(account.id) +
" " + account.state + " " + account.state +
(account.last_connected == null ? "" : " " + dtf.format(account.last_connected)) + (account.last_connected == null ? "" : " " + dtf.format(account.last_connected)) +
"\r\n"); "\r\n");
@ -2098,6 +2100,7 @@ public class Log {
" poll=" + folder.poll + "/" + folder.poll_factor + " poll=" + folder.poll + "/" + folder.poll_factor +
" days=" + folder.sync_days + "/" + folder.keep_days + " days=" + folder.sync_days + "/" + folder.keep_days +
" msgs=" + folder.content + "/" + folder.messages + "/" + folder.total + " msgs=" + folder.content + "/" + folder.messages + "/" + folder.total +
" ops=" + db.operation().getOperationCount(folder.id, null) +
" unseen=" + unseen + " notifying=" + notifying + " unseen=" + unseen + " notifying=" + notifying +
" " + folder.state + " " + folder.state +
(folder.last_sync == null ? "" : " " + dtf.format(folder.last_sync)) + (folder.last_sync == null ? "" : " " + dtf.format(folder.last_sync)) +
@ -2108,12 +2111,14 @@ public class Log {
} }
} }
for (EntityAccount account : accounts) for (EntityAccount account : accounts) {
if (account.synchronize) int ops = db.operation().getOperationCount(account.id);
if (account.synchronize || ops > 0)
try { try {
JSONObject jaccount = account.toJSON(); JSONObject jaccount = account.toJSON();
jaccount.put("state", account.state == null ? "null" : account.state); jaccount.put("state", account.state == null ? "null" : account.state);
jaccount.put("warning", account.warning); jaccount.put("warning", account.warning);
jaccount.put("operations", ops);
jaccount.put("error", account.error); jaccount.put("error", account.error);
jaccount.put("capabilities", account.capabilities); jaccount.put("capabilities", account.capabilities);
@ -2145,6 +2150,7 @@ public class Log {
jfolder.put("selectable", folder.selectable); jfolder.put("selectable", folder.selectable);
jfolder.put("inferiors", folder.inferiors); jfolder.put("inferiors", folder.inferiors);
jfolder.put("auto_add", folder.auto_add); jfolder.put("auto_add", folder.auto_add);
jfolder.put("operations", db.operation().getOperationCount(folder.id, null));
jfolder.put("error", folder.error); jfolder.put("error", folder.error);
if (folder.last_sync != null) if (folder.last_sync != null)
jfolder.put("last_sync", new Date(folder.last_sync).toString()); jfolder.put("last_sync", new Date(folder.last_sync).toString());
@ -2167,6 +2173,7 @@ public class Log {
} catch (JSONException ex) { } catch (JSONException ex) {
size += write(os, ex.toString() + "\r\n"); size += write(os, ex.toString() + "\r\n");
} }
}
} }
db.attachment().setDownloaded(attachment.id, size); db.attachment().setDownloaded(attachment.id, size);

Loading…
Cancel
Save