API reports incorrect unread count

I’m making a Chrome extension for NewsBlur, but I’m getting ghost posts! I don’t know what is going on but I’m not seeing any items in NewsBlur but the API says I have 2 unread neutrals on some of my feeds, I’m using refresh_feeds. I think it’s a bug in the API.

1 Like

Try logging in to the website. Do you see the same unread count?

That mirrors what Blar seems to be doing on Android.

It’s almost as if the count of unread on the API is lagging behind the website by an amount of time, so stores which have been read on the website are still being counted as unread on the API counter.

So I read a story on newsblur.com, then 30 minutes later check the app, and the count still shows an unread story, though going into the feed itself shows all stories as read.

I assume it’s more of a misunderstanding of the API than a specific bug, but I’m unsure, I’ve only poked around a little.

For clarification, I’m not loggin into the API using /api/login - I’ll try that later this week and report back.

The website uses the API, so there are no differences between what you get and what the website gets.

But you need to call /reader/refresh_feeds to force a re-count of unreads. If you just call /reader/feeds, you’ll get stale counts. I’m going to update the API docs to reflect this. Maybe adding in an optional parameter to /reader/feeds to force a recount?

I’ve done a quick check in the blar source code and yes, it never calls /reader/refresh_feeds, only ever the /reader/feeds API, so that sounds like my issue.

When I add in a check for refresh_feeds after login, the counts do return correct values.

I wonder if it’s worth changing the logic slightly, so rather than say “Only call /reader/refresh_feeds at most once a minute”, instead have “/reader/feeds” do a refresh itself if one hasn’t been done in the last (say) 5 minutes?

Thanks for pointing this out, I’ll update Blar to properly refresh unread counts soon.