-
-
Notifications
You must be signed in to change notification settings - Fork 845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Greader API : get modified items #2566
Comments
Hello @Shinokuni and welcome :-) First, I would like to say that getting the synchronisation strategy right is essential for a good client. Except News+ and to a lower extent EasyRSS, the other clients I have tested all have inefficient synchronisation strategies (in some cases very bad). By inefficient, I mean far too many requests, redundant requests, as well as expensive requests for the client and/or the server (leading to slow synchronisation, high battery consumption, high bandwidth consumption, high CPU usage on client and server, high database usage on server, etc.). Therefore, I am always very pleased to provide the exact API calls to perform.
It is also possible in News+ to synchronise / "pull for refresh" a specific category/folder, or feed, or tag/label, but that is only necessary when the user wants to get read items or more/older items than the global limit. Full log:
Do not hesitate to ask again, but please consider this synchronisation strategy. |
@Alkarex Sounds like a good thing to stick in the docs which should make it easier to find through a search engine, maybe somewhere in https://freshrss.github.io/FreshRSS/en/developers/01_First_steps.html? |
First of all, thank you for your answer. Here is the way Readrops handle synchronization. Initial syncOne the main functionalities of Readrops is to provide an offline experience. Therefore, a large quantity of items is fetched and stored locally when doing the initial synchronization. Steps :
Classic syncSteps :
The way Readrops handles synchronization is more or less the same as what you described expect Readrops doesn't fetch starred items and makes one query per item read state. The initial point of my issue was to know if there is a way to get modified items since a precise time. This would allow to have a coherent read/unread state for all items and all platforms. Do I have to conclude that there is no way to do this ? |
Speaking just for myself of course, but I doubt I'd even consider using a third-party client except for the offline experience. ;-) (That's why I currently use EasyRSS.) |
Year, I believe too that it is important to have an offline access to its feeds. Personally, not having an offline access wouldn't bother me that much because the situations where I don't have any connexion (RER A de ses morts) are infrequent and I can do something else. |
@Shinokuni Could you please explain that again? Please check requests 4 and 7. |
Year, sorry. I meant one request to mark items as read and one request to mark items as unread with
This is interesting. If I use the parameter |
No, it is not the date when the items where modified, but the date when they were discovered / added to database. They are still the best calls to get the states as they only retrieve IDs. |
Does this mean that if I change the read state of a item created three months ago, I will have to fetch three months of items ids to get it ? In this case, it won't be useful because too expensive. |
I agree that the API could surely be improved. We could make some additions (I am open to that), but changing the behaviour of existing calls risk breaking other clients obeying the Google Reader API. When you want the states and ask the IDs, you ask only the unread ones (The IDs not in the list are read). The length of that list is at max the number of unread articles on the server, and can be limited by number and date, so it is not that bad. In practice, I have in general between 1k and 4k unread articles, 300k+ read articles, ~160 feeds, ~17 categories, 400+ favourites, ~10 tags. A full sync in News+ takes about ~3s. |
You are right, it is not that bad. But I will still see for a limitation to avoid fetching all unread items ids. I have with my personal account 4k unread items, so 4k local items to update if I fetch all of them. I don't mind when doing the initial sync, but for a classic one, it is not insignificant.
That's nice !
Anyway, a big thanks for taking the time to answer me. I will investigate the |
@Shinokuni I have tested your client today, and it looks very good already, congrats :-) |
Hello, as promised in readrops/Readrops#53 (comment), here is a post about FreshRSS synchronization in Readrops. Due to a lack of time, I wasn't able to make it sooner. IssuesI recently (more or less) worked on the addition of FreshRSS starred items in Readrops and it made me work again on item read state synchronization. If I didn't really encounter problems for managing requests, it was on the other hand more difficult on the db side. First, SQLite restricts to 999 the number of arguments you can give to an IN operator. It means that when you get more than a thousand items ids with
Here is a log of the synchronization after I implemented the fetch of the starred items. The starred items insertion checks for each item if it already exists in db and inserts it if not, which is pretty slow as the test data was about 10 starred items. Then items star state is updated with the ids from The synchronization doesn't contains the update of the read state and doesn't fetch any new items but lasts 5 seconds which is way too much. I had to improve all of this. SolutionRequests strategyHere is the new request strategy:
I don't make any further calls as it's not needed with the database strategy below. Database strategyI added a few new tables:
Instead of directly updating each item read state with the ids (limited to 999) in the query, all unread items ids are stored in a new table and then used to update the read state. Before inserting unread items ids in the new table, all old items ids from the previous synchronization are deleted. This process makes the update faster even if it's not perfect. Instead of dealing with starred items ids, only starred items are fetched and stored in a separate table. This ensures not to have to do any request and query to update starred items read and star state. Before the insertion, all previous inserted items from the last synchronization are deleted. The fetch of starred items is limited to 1000 for performance. Result
The result is a lot better. Some steps were removed and other improved. Of course, this result was made with good conditions: fast WI-FI connection, fast phone (OP 6), no new items and very few starred items. A synchronization with less good variables would last around 3 seconds. Things left to doI didn't write anything about pushing read/star state changes from Readrops. I have two solutions here:
Feel free to suggest changes, I'm totally open to modifications. |
@Shinokuni Thanks for the update; that looks very good, congrats 👍 |
Thanks for the suggestion, I will think about it! |
Hello,
I am writing an Android RSS client with FreshRSS support and I encountered a problem when syncing items using Greader API.
I would like to get from the server items which read state has been modified. Let's say I synchronize my items list with my Android client. Then, I mark some items as read in the web client. I would like to make notice the mobile client that several items have been marked as read.
I already know that if an item contains
user/-/state/com.google/read
in the categories field in the returned json, like that :it is read an I can mark it as read in the mobile client database.
When fetching items with
reader/api/0/stream/contents/user/-/state/com.google/reading-list
end point and the parameterot
(unix timestamp), I can get new items, and, if they have been read before the mobile client fetch them, they will haveuser/-/state/com.google/read
in their categories field. But if I mark an item older than the ot parameter as read, I won't get it.Am I missing something which could solve this problem ? If not, Is there anything doable for this ?
Otherwise, thanks for this awesome project that is FreshRSS !
The text was updated successfully, but these errors were encountered: