summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodulserver/src/main/java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java
index eb5bebff..79b16e66 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java
@@ -849,8 +849,11 @@ public class DbImage {
// Get all image base entries which have no image version
MysqlStatement sel = connection.prepareStatement("SELECT i.imagebaseid FROM imagebase i"
+ " LEFT JOIN imageversion v USING (imagebaseid)"
- + " WHERE i.updatetime < :cutoff AND v.imageversionid IS NULL");
- sel.setLong("cutoff", Util.unixTime() - 86400 * 14);
+ + " WHERE ("
+ + " i.updatetime < :cutoff1 OR (i.updatetime < :cutoff2 AND (i.updatetime - i.createtime) < 600))"
+ + " AND v.imageversionid IS NULL");
+ sel.setLong("cutoff1", Util.unixTime() - 86400 * 14);
+ sel.setLong("cutoff2", Util.unixTime() - 3600 * 2);
ResultSet rs = sel.executeQuery();
// Now delete them all
MysqlStatement stmt = connection.prepareStatement("DELETE FROM imagebase"