MCPcopy Create free account
hub / github.com/M66B/FairEmail / run

Method run

app/src/main/java/eu/faircode/email/EntityLog.java:141–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139
140 Helper.getSerialExecutor().submit(new Runnable() {
141 @Override
142 public void run() {
143 // Check available storage space
144 if (!ok || (++count % LOG_DELETE_BATCH_SIZE) == 0) {
145 long cake = Helper.getAvailableStorageSpace();
146 boolean wasOk = ok;
147 ok = (cake > Helper.MIN_REQUIRED_SPACE);
148 if (!ok)
149 if (wasOk) {
150 entry.type = Type.General;
151 entry.account = null;
152 entry.folder = null;
153 entry.message = null;
154 entry.data = "Insufficient storage space=" +
155 Helper.humanReadableByteCount(cake) + "/" +
156 Helper.humanReadableByteCount(Helper.MIN_REQUIRED_SPACE);
157 } else
158 return;
159 }
160
161 try {
162 db.beginTransaction();
163 db.log().insertLog(entry);
164 db.setTransactionSuccessful();
165 } catch (Throwable ex) {
166 Log.e(ex);
167 } finally {
168 db.endTransaction();
169 }
170
171 long now = new Date().getTime();
172 if (last_cleanup == null || last_cleanup + LOG_CLEANUP_INTERVAL < now) {
173 last_cleanup = now;
174 cleanup(acontext, now - LOG_KEEP_DURATION);
175 }
176 }
177 });
178 }
179

Callers

nothing calls this directly

Calls 9

eMethod · 0.95
cleanupMethod · 0.95
insertLogMethod · 0.80
beginTransactionMethod · 0.45
logMethod · 0.45
endTransactionMethod · 0.45

Tested by

no test coverage detected