summaryrefslogtreecommitdiff
path: root/plugins/Facebook/facebookutil.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-05-22 17:43:56 -0700
committerBrion Vibber <brion@pobox.com>2010-05-22 17:43:56 -0700
commitdc22ed84807555f6a16c041c16b3bc607c6587d8 (patch)
treedd9f02cc4d14475915e7bc6558d315ff8bc4c8d7 /plugins/Facebook/facebookutil.php
parent07ac946717f5db93039a5628cc46e4c70e8f30b9 (diff)
Hotpatch for Facebook mirror problems: drop messages when hitting rate limit (err 341) instead of retrying forever. On unknown errors, now throwing an exception so it'll hit the message retry limits.
Diffstat (limited to 'plugins/Facebook/facebookutil.php')
-rw-r--r--plugins/Facebook/facebookutil.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/plugins/Facebook/facebookutil.php b/plugins/Facebook/facebookutil.php
index ab2d42726..045891649 100644
--- a/plugins/Facebook/facebookutil.php
+++ b/plugins/Facebook/facebookutil.php
@@ -158,9 +158,22 @@ function facebookBroadcastNotice($notice)
remove_facebook_app($flink);
- } else {
+ } else if ($code == 341) {
+ // 341 Feed action request limit reached - Unable to update Facebook status
+ // Reposting immediately probably won't work, so drop the message for now. :(
+
+ common_log(LOG_ERR, "Facebook rate limit hit: dropping notice $notice->id");
+ return true;
+ } else {
// Try sending again later.
+ //
+ // @fixme at the moment, returning false here could lead to an infinite loop
+ // if the error condition isn't actually transitory.
+ //
+ // Temporarily throwing an exception to kill the process so it'll hit our
+ // retry limits.
+ throw new Exception("Facebook error $code on notice $notice->id");
return false;
}