Skip to content

Conversation

@khaykov
Copy link
Contributor

@khaykov khaykov commented Jun 9, 2016

Fixes #2647

Currently, when you stop following a blog from outside of an Android app, the posts from that blog will remain in the reader, unless you stop following/block the blog from within the app. If you wont do this those posts will be deleted one by one when the limit of posts in DB will be reached.

This PR addresses this, by adding a query that deletes all the posts from unfollowed blogs to the end of the purge call executed at the application start.

To test: Unfollow blog, close the app (completely), reopen app - posts from unfollowed blogs should be gone.

Needs review: @nbradbury

@khaykov khaykov added the Reader label Jun 9, 2016
@nbradbury nbradbury self-assigned this Jun 9, 2016
@nbradbury
Copy link
Contributor

The SQL for removing posts in unfollowed blogs is correct, but the timing isn't so good. Purging happens when the reader starts, which is before followed blogs are updated - so the posts won't be removed until the 2nd time you start the reader.

It might be better to have a separate routine which purges unfollowed posts and call that when we know followed blogs have changed here.

@khaykov
Copy link
Contributor Author

khaykov commented Jun 10, 2016

Thanks for pointing me in right direction, Nick! Also, from your experience with the reader db, do you think we should make the purge call for unfollowed posts async? I don't think it will have to delete a lot of posts (considering we have a cap on total number of posts in db), and we can delete only posts and leave comments, likes, etc. for regular purge call. Wonder, will there be any performance impact if we will call it from main thread.

@nbradbury
Copy link
Contributor

nbradbury commented Jun 10, 2016

do you think we should make the purge call for unfollowed posts async?

I think it would be best to do the deletion in the background, but if you put the call to delete the posts here it'll already be done in the background, and it'll happen before the reader post list is told followed blogs are changed.

@khaykov
Copy link
Contributor Author

khaykov commented Jun 15, 2016

Done! Was supposed to be a quick fix, but I kept getting some unexpected results and decided to dive a bit deeper into reader db/lifecycle to figure out how everything works :)

Also, while testing I found that posts from blogs followed from web do not appear in reader untill explicit refresh. Filled a separate issue - #4231.

@nbradbury
Copy link
Contributor

:shipit:

@nbradbury nbradbury merged commit 711c7af into develop Jun 15, 2016
@nbradbury nbradbury deleted the issue/2647-remove-posts-from-unfollowed-blogs branch June 15, 2016 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reader should update db when a blog is removed from a list

3 participants