Many people are experiencing issue with rate limit - see issues 1073116, 1209310, etc.

Attached patch improves caching mechanism to deal with this issues. It introduce following three improvements:
1) minimum cache time: before this period expiries no request to twitter server will be done and cache will be reused. Set to 20 minutes
2) maximum cache time: before this period expiries, cached data will be reused in case API calls fails due to error. Set to 12 hours.
3) cache speed up: amount of time, by which minimum cache time should be decreased every 20 minutes(minimum cache time). Set to 1 minute.

In case API will be unavailable for longer time you can expect following delays: 19, 18, 17, 16, .... 1, 1, 1, 1, 0, 0, 0

This patched showed significant improvement on busy shared web-hosting and can be seen in action at http://www.radekdostal.com

Comments

radekdostal’s picture

Issue summary: View changes

Adding domain where patch can be seen in action

geoffreyr’s picture

StatusFileSize
new4.32 KB

Tried to reroll this one against 7.x-1.x if anyone wants it.

aasarava’s picture

StatusFileSize
new4.44 KB

Rerolled for 7.x-2.x-dev (as of Jun 13 2013).

mthomas’s picture

This is great, thanks!

mthomas’s picture

Issue summary: View changes

Better explanation of speed up

BarisW’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks. Works great. Please commit.
Updated the version, as this patch applies against the 7.x-2.x branch.

joachim’s picture

Category: Bug report » Feature request
Status: Reviewed & tested by the community » Needs work

This looks like an interesting approach, but I'm not quite sure I follow all of it!

Any chance of a more detailed explanation in the summary?

After that, the patch will need a fair bit of cleanup -- mostly formatting, but also a hook_update_N() to convert the variable it's removing.

+++ b/twitter_pull.module
@@ -62,7 +72,7 @@ function twitter_pull_theme() {
-    if (!empty($variables['tweets']) && is_array($variables['tweets'])) {
+    if (isset($variables['tweets']) && !empty($variables['tweets'])) {

This looks like an unrelated change.

jennypanighetti’s picture

Can this patch be committed please? Thanks.