Commit 39d1ab31 by pye52

修复数据库清理的细节问题

parent bf2438fc
...@@ -36,28 +36,31 @@ public class DatabaseMonitor extends Worker { ...@@ -36,28 +36,31 @@ public class DatabaseMonitor extends Worker {
builder.append("\n") builder.append("\n")
.append("command数据库当前旧数据量: ") .append("command数据库当前旧数据量: ")
.append(commandCount); .append(commandCount);
if (commandCount >= DATABASE_LIMIT) { if (commandCount > DATABASE_LIMIT) {
commandRepository.clearOldData(DATABASE_LIMIT); int clearCount = commandRepository.clearOldData(commandCount - DATABASE_LIMIT);
builder.append("\n") builder.append("\n")
.append("command数据库已清理旧数据"); .append("command数据库已清理旧数据: ")
.append(clearCount);
} }
int payDataCount = payDataRepository.countOldData(); int payDataCount = payDataRepository.countOldData();
builder.append("\n") builder.append("\n")
.append("payData数据库当前旧数据量: ") .append("payData数据库当前旧数据量: ")
.append(payDataCount); .append(payDataCount);
if (payDataCount >= DATABASE_LIMIT) { if (payDataCount > DATABASE_LIMIT) {
payDataRepository.clearOldData(DATABASE_LIMIT); int clearCount = payDataRepository.clearOldData(payDataCount - DATABASE_LIMIT);
builder.append("\n") builder.append("\n")
.append("payData数据库已清理旧数据"); .append("payData数据库已清理旧数据: ")
.append(clearCount);
} }
int payResponseCount = payResponseRepository.countOldData(); int payResponseCount = payResponseRepository.countOldData();
builder.append("\n") builder.append("\n")
.append("payResponse数据库当前旧数据量: ") .append("payResponse数据库当前旧数据量: ")
.append(payResponseCount); .append(payResponseCount);
if (payResponseCount >= DATABASE_LIMIT) { if (payResponseCount > DATABASE_LIMIT) {
payResponseRepository.clearOldData(DATABASE_LIMIT); int clearCount = payResponseRepository.clearOldData(payResponseCount - DATABASE_LIMIT);
builder.append("\n") builder.append("\n")
.append("payResponse数据库已清理旧数据"); .append("payResponse数据库已清理旧数据: ")
.append(clearCount);
} }
LogUtils.d(TAG, builder); LogUtils.d(TAG, builder);
return Result.success(); return Result.success();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment