Skip to content

Commit

Permalink
Fix signed int causing issues calculating expiry time for images
Browse files Browse the repository at this point in the history
  • Loading branch information
bundabrg committed Jul 21, 2020
1 parent 902b2e0 commit aad3c23
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -113,16 +113,19 @@ public class SkinProvider {
}

int count = 0;
final long expireTime = ((long)GeyserConnector.getInstance().getConfig().getCacheImages()) * ((long)1000 * 60 * 60 * 24);
for (File imageFile : Objects.requireNonNull(cacheFolder.listFiles())) {
if (imageFile.lastModified() < System.currentTimeMillis() - (GeyserConnector.getInstance().getConfig().getCacheImages() * 1000 * 60 * 60 * 24)) {
if (imageFile.lastModified() < System.currentTimeMillis() - expireTime) {
//noinspection ResultOfMethodCallIgnored
imageFile.delete();
count++;
}
}

GeyserConnector.getInstance().getLogger().debug(String.format("Removed %d cached image files as they have expired", count));
}, 1, 1440, TimeUnit.MINUTES);
if (count > 0) {
GeyserConnector.getInstance().getLogger().debug(String.format("Removed %d cached image files as they have expired", count));
}
}, 10, 1440, TimeUnit.MINUTES);
}
}

0 comments on commit aad3c23

Please sign in to comment.