Commit 39d1ab31 by pye52

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

parent bf2438fc
......@@ -36,28 +36,31 @@ public class DatabaseMonitor extends Worker {
builder.append("\n")
.append("command数据库当前旧数据量: ")
.append(commandCount);
if (commandCount >= DATABASE_LIMIT) {
commandRepository.clearOldData(DATABASE_LIMIT);
if (commandCount > DATABASE_LIMIT) {
int clearCount = commandRepository.clearOldData(commandCount - DATABASE_LIMIT);
builder.append("\n")
.append("command数据库已清理旧数据");
.append("command数据库已清理旧数据: ")
.append(clearCount);
}
int payDataCount = payDataRepository.countOldData();
builder.append("\n")
.append("payData数据库当前旧数据量: ")
.append(payDataCount);
if (payDataCount >= DATABASE_LIMIT) {
payDataRepository.clearOldData(DATABASE_LIMIT);
if (payDataCount > DATABASE_LIMIT) {
int clearCount = payDataRepository.clearOldData(payDataCount - DATABASE_LIMIT);
builder.append("\n")
.append("payData数据库已清理旧数据");
.append("payData数据库已清理旧数据: ")
.append(clearCount);
}
int payResponseCount = payResponseRepository.countOldData();
builder.append("\n")
.append("payResponse数据库当前旧数据量: ")
.append(payResponseCount);
if (payResponseCount >= DATABASE_LIMIT) {
payResponseRepository.clearOldData(DATABASE_LIMIT);
if (payResponseCount > DATABASE_LIMIT) {
int clearCount = payResponseRepository.clearOldData(payResponseCount - DATABASE_LIMIT);
builder.append("\n")
.append("payResponse数据库已清理旧数据");
.append("payResponse数据库已清理旧数据: ")
.append(clearCount);
}
LogUtils.d(TAG, builder);
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