q4q5q6qw commented on issue #16145:
URL:
https://github.com/apache/dolphinscheduler/issues/16145#issuecomment-2288739590
I have the same problem. I wonder if I can start a scheduled task in the
code to perform the cleanup.
In addition, two parameters are added to the configuration item. The first
parameter indicates whether to enable the automatic deletion function, and the
second parameter indicates the time (the data generated one month ago is
expired data). The pseudo-code is as follows:
public void cleanupExpiredInstances() {
boolean isExpired = isInstanceExpired(instance);
if (isExpired) {
instanceMapper.batchDelete(instance);
}
}
private boolean isInstanceExpired(Instance instance) {
long expireThreshold = 7 * 24 * 3600 * 1000; // 一周
long currentTime = System.currentTimeMillis();
long createTime = instance.getStartTime().getTime();
return currentTime - createTime > expireThreshold;
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]