删除1周前无用的im task数据
This commit is contained in:
parent
eccef94911
commit
834f986196
@ -83,8 +83,8 @@ public class PrivateController {
|
||||
}
|
||||
|
||||
@PostMapping("/private/message/expungeTask")
|
||||
public Object expungeTask() {
|
||||
int count = expungeImTaskJob.runWithDefault();
|
||||
public Object expungeTask(@RequestBody(required = false) ExpungeImTaskJob.Param param) {
|
||||
int count = expungeImTaskJob.expunge(param);
|
||||
return CommonResponse.success(count);
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ public class ExpungeImTaskJob extends IJobHandler {
|
||||
log.info("start - run job with param={}", paramStr);
|
||||
try {
|
||||
Param param = JSONObjectUtil.parseObject(paramStr, Param.class);
|
||||
executeImpl(param);
|
||||
expunge(param);
|
||||
log.info("end - run job with param={}", param);
|
||||
return ReturnT.SUCCESS;
|
||||
} catch (Exception e) {
|
||||
@ -38,11 +38,8 @@ public class ExpungeImTaskJob extends IJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public int runWithDefault() {
|
||||
return executeImpl(new Param());
|
||||
}
|
||||
|
||||
private int executeImpl(Param param) {
|
||||
public int expunge(Param nullableParam) {
|
||||
Param param = nullableParam == null ? new Param() : nullableParam;
|
||||
Date until = DateTime.now().minusDays(param.daysAgo).toDate();
|
||||
int count = messageTaskMapper.expunge(until);
|
||||
log.info("deleted count={}", count);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user