Improved bread crumb

pull/162/head
M66B 5 years ago
parent 721d151dc4
commit a60de82922

@ -26,6 +26,7 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteConstraintException;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -145,15 +146,6 @@ class Core {
" msg=" + op.message + " msg=" + op.message +
" args=" + op.args); " args=" + op.args);
Map<String, String> crumb = new HashMap<>();
crumb.put("name", op.name);
crumb.put("args", op.args);
crumb.put("folder", op.account + ":" + op.folder + ":" + folder.type);
if (op.message != null)
crumb.put("message", Long.toString(op.message));
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
Log.breadcrumb("operation", crumb);
// Fetch most recent copy of message // Fetch most recent copy of message
EntityMessage message = null; EntityMessage message = null;
if (op.message != null) if (op.message != null)
@ -197,6 +189,7 @@ class Core {
} }
} }
} }
if (skip) { if (skip) {
Log.i(folder.name + Log.i(folder.name +
" skipping op=" + op.id + "/" + op.name + " skipping op=" + op.id + "/" + op.name +
@ -205,6 +198,15 @@ class Core {
continue; continue;
} }
Map<String, String> crumb = new HashMap<>();
crumb.put("name", op.name);
crumb.put("args", op.args);
crumb.put("folder", op.account + ":" + op.folder + ":" + folder.type);
if (op.message != null)
crumb.put("message", Long.toString(op.message));
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
Log.breadcrumb("start operation", crumb);
if (istore instanceof POP3Store) if (istore instanceof POP3Store)
switch (op.name) { switch (op.name) {
case EntityOperation.SEEN: case EntityOperation.SEEN:
@ -297,6 +299,9 @@ class Core {
} }
} }
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
Log.breadcrumb("end operation", crumb);
// Operation succeeded // Operation succeeded
db.operation().deleteOperation(op.id); db.operation().deleteOperation(op.id);
} catch (Throwable ex) { } catch (Throwable ex) {
@ -1861,6 +1866,14 @@ class Core {
runRules(context, imessage, message, rules); runRules(context, imessage, message, rules);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} catch (SQLiteConstraintException ex) {
Log.e(ex);
Map<String, String> crumb = new HashMap<>();
crumb.put("folder", message.account + ":" + message.folder + ":" + folder.type);
crumb.put("message", uid + ":" + message.uid);
crumb.put("what", ex.getMessage());
Log.breadcrumb("insert", crumb);
} finally { } finally {
db.endTransaction(); db.endTransaction();
} }

Loading…
Cancel
Save