Browse code

[replication] BM-15281 Fix: only expire orphan bodies we created more than 2 days ago

Thomas Cataldo authored on 16/10/2019 09:09:13
Showing 1 changed files
... ...
@@ -95,8 +95,8 @@ public class MessageBodyStore extends JdbcAbstractStore {
95 95
 	}
96 96
 
97 97
 	public List<String> deleteOrphanBodies() throws SQLException {
98
-		String query = "delete from t_message_body b where created < NOW() - INTERVAL '2 hour' and not exists (select from t_mailbox_record where message_body_guid = b.guid)";
99
-		String selectQuery = "select b.guid from t_message_body b where created < NOW() - INTERVAL '2 hour' and not exists (select from t_mailbox_record where message_body_guid = b.guid)";
98
+		String query = "delete from t_message_body b where created < NOW() - INTERVAL '2 days' and not exists (select from t_mailbox_record where message_body_guid = b.guid)";
99
+		String selectQuery = "select b.guid from t_message_body b where created < NOW() - INTERVAL '2 days' and not exists (select from t_mailbox_record where message_body_guid = b.guid)";
100 100
 		List<String> selected = select(selectQuery, StringCreator.FIRST, (rs, index, val) -> index);
101 101
 		int handled = delete(query, new Object[0]);
102 102
 		logger.info("{} orphan bodies purged.", handled);