Refreshing RSS feeds at near-realtime intervals

北城以北 提交于 2019-12-03 16:38:50

I've used something like you first option. Start with a default time before retrieving a feed. If new items are found reduce the waiting period with 10%, otherwise increase with 10%. Perform this adaption with every update and the system adjusts itself.

You could use different percentages, e.g. decrease the time quicker to respond better to change in update frequency.

Include a minimum and maximum timespan to keep waiting within a predefined range.

It's not perfect but was good enough for me.

There is no way to make "pulling" quick and efficient. You will either poll more often (and be less efficient) or be more efficient by polling less often.

The only way to acheive near realtime experience is to poll at the right time :)

Luckily some publihsers (more and more!) use PubSubHubbub to update their feeds and let subscribers know. Other services like Superfeedr (I work for Superfeedr) use different techniques to learn when is the best time to fetch a feed (based on historic updates, updates in related feeds... etc).

Though it's only part of the solution, you can also (if the feed is served over HTTP) check the Cache-Control and Expires headers of the RSS feed for hints on how often you should fetch the feed.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!