Only clean up read stories.

This commit is contained in:
dosiecki 2014-06-29 16:11:43 -07:00
parent fec57f7519
commit 55c08f10af
2 changed files with 4 additions and 3 deletions

View file

@ -56,9 +56,10 @@ public class BlurDatabaseHelper {
String q = "DELETE FROM " + DatabaseConstants.STORY_TABLE +
" WHERE " + DatabaseConstants.STORY_ID + " IN " +
"( SELECT " + DatabaseConstants.STORY_ID + " FROM " + DatabaseConstants.STORY_TABLE +
" WHERE " + DatabaseConstants.STORY_FEED_ID + " = " + feedId +
" WHERE " + DatabaseConstants.STORY_READ + " = 1" +
" AND " + DatabaseConstants.STORY_FEED_ID + " = " + feedId +
" ORDER BY " + DatabaseConstants.STORY_TIMESTAMP + " DESC" +
" LIMIT -1 OFFSET " + AppConstants.MAX_STORIES_STORED +
" LIMIT -1 OFFSET " + AppConstants.MAX_READ_STORIES_STORED +
")";
dbRW.execSQL(q);
}

View file

@ -46,7 +46,7 @@ public class AppConstants {
public static final int READING_STORY_PRELOAD = 5;
// max old stories to keep in the DB per feed before fetching new unreads
public static final int MAX_STORIES_STORED = 500;
public static final int MAX_READ_STORIES_STORED = 10;
// how many unread stories to fetch via hash at a time
public static final int UNREAD_FETCH_BATCH_SIZE = 20;