- Timestamp:
- Nov 12, 2016 11:10:55 PM (4 years ago)
- Branches:
- master
- Children:
- 0108c1c
- Parents:
- 6a72c29
- Location:
- router/java/src/net/i2p/router/peermanager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
router/java/src/net/i2p/router/peermanager/PeerManager.java
r6a72c29 ra8976d2 58 58 private static final long REORGANIZE_TIME_LONG = 351*1000; 59 59 private static final long STORE_TIME = 19*60*60*1000; 60 private static final long EXPIRE_AGE = 3*24*60*60*1000; 60 61 61 62 public static final String TRACKED_CAPS = "" + … … 103 104 104 105 /** 105 * Reorganize the profiles. Also periodically store them. 106 * Reorganize the profiles. Also periodically store them, 107 * and delete very old ones. 106 108 * 107 109 * This takes too long to run on the SimpleTimer2 queue … … 132 134 _log.debug("Periodic profile store start"); 133 135 storeProfiles(); 136 _persistenceHelper.deleteOldProfiles(EXPIRE_AGE); 134 137 _log.debug("Periodic profile store end"); 135 138 } catch (Throwable t) { -
router/java/src/net/i2p/router/peermanager/ProfilePersistenceHelper.java
r6a72c29 ra8976d2 230 230 } 231 231 232 /** 233 * Delete profile files with timestamps older than 'age' ago 234 * @since 0.9.28 235 */ 236 public void deleteOldProfiles(long age) { 237 long cutoff = System.currentTimeMillis() - age; 238 List<File> files = selectFiles(); 239 int i = 0; 240 for (File f : files) { 241 if (!f.isFile()) 242 continue; 243 if (f.lastModified() < cutoff) { 244 i++; 245 f.delete(); 246 } 247 } 248 if (_log.shouldWarn()) 249 _log.warn("Deleted " + i + " old profiles"); 250 } 251 232 252 private boolean isExpired(long lastSentToSuccessfully) { 233 253 long timeSince = _context.clock().now() - lastSentToSuccessfully;
Note: See TracChangeset
for help on using the changeset viewer.