You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: alter unsaved search deletion and add option for last used lists
This commit alters the deletion of unsaved searches to be carried out each time the cron script runs.
It also adds the option for libraries to choose to have stored information about the last list a
user has accessed deleted after 14 days.
ResultSetnumSearchesRS = dbConn.prepareStatement("SELECT count(id) from search where created < (CURDATE() - INTERVAL 2 DAY) and saved = 0").executeQuery();
424
+
ResultSetnumSearchesRS = dbConn.prepareStatement("SELECT count(id) from search where saved = 0").executeQuery();
424
425
numSearchesRS.next();
425
426
longnumSearches = numSearchesRS.getLong(1);
426
427
longbatchSize = 100000;
427
428
longnumBatches = (numSearches / batchSize) + 1;
428
429
processLog.addNote("Found " + numSearches + " expired searches that need to be removed. Will process in " + numBatches + " batches");
429
430
processLog.saveResults();
430
431
for (inti = 0; i < numBatches; i++){
431
-
PreparedStatementsearchesToRemove = dbConn.prepareStatement("SELECT id from search where created < (CURDATE() - INTERVAL 2 DAY) and saved = 0 LIMIT 0, " + batchSize, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
432
+
PreparedStatementsearchesToRemove = dbConn.prepareStatement("SELECT id from search where saved = 0 LIMIT 0, " + batchSize, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
432
433
PreparedStatementremoveSearchStmt = dbConn.prepareStatement("DELETE from search where id = ?");
PreparedStatementlastListUsedEntriesToDeleteStmt = dbConn.prepareStatement("SELECT lastListUsed from user where user.homeLocationId IN (" + libraryLocations + ") and lastListused < ?");
0 commit comments