From da5e6a6023b33c51a10f335317ca8b4e18af1e2b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 13 Jan 2010 19:15:54 +0000 Subject: When Twitter bridge encounters a 403 (rate limit) err, drop the notice instead of requeuing. --- plugins/TwitterBridge/twitter.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index e133ce6f7..33dfb788b 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -269,19 +269,23 @@ function process_error($e, $flink, $notice) common_log(LOG_WARNING, $logmsg); - if ($code == 401) { - + switch($code) { + case 401: // Probably a revoked or otherwise bad access token - nuke! - remove_twitter_link($flink); return true; - - } else { + break; + case 403: + // User has exceeder her rate limit -- toss the notice + return true; + break; + default: // For every other case, it's probably some flakiness so try // sending the notice again later (requeue). return false; + break; } } -- cgit v1.2.3-54-g00ecf From ec873922e3af7efd1aa6d26ea19c90999f9961b3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 13 Jan 2010 20:11:00 -0800 Subject: Gracefully skip missing user entries when initializing inboxes in bulk --- scripts/initializeinbox.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/initializeinbox.php b/scripts/initializeinbox.php index bc31cba15..5ae9f7d03 100644 --- a/scripts/initializeinbox.php +++ b/scripts/initializeinbox.php @@ -72,7 +72,7 @@ try { foreach ($ids as $id) { $user = User::staticGet('id', $id); if (empty($user)) { - throw new Exception("Can't find user with id '$id'."); + print "Can't find user with id '$id'.\n"; } initializeInbox($user); } -- cgit v1.2.3-54-g00ecf From 82f2fe8cca3914ad2a962855951be226141a9d78 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 13 Jan 2010 20:30:42 -0800 Subject: in case we have cached 'fake' inboxes, make sure we rebuild them running initializeinbox.php --- scripts/initializeinbox.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/initializeinbox.php b/scripts/initializeinbox.php index 5ae9f7d03..781179401 100644 --- a/scripts/initializeinbox.php +++ b/scripts/initializeinbox.php @@ -93,6 +93,12 @@ function initializeInbox($user) $inbox = Inbox::staticGet('user_id', $user_id); + if ($inbox && !empty($inbox->fake)) { + if (!have_option('q', 'quiet')) { + echo "(replacing faux cached inbox)"; + } + $inbox = false; + } if (!empty($inbox)) { if (!have_option('q', 'quiet')) { print "SKIP\n"; -- cgit v1.2.3-54-g00ecf From 35a2f8de4d46c403d6ca17695a8d040f003125c8 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 13 Jan 2010 20:46:44 -0800 Subject: actually use the user id instead of 0 ;) --- scripts/initializeinbox.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/initializeinbox.php b/scripts/initializeinbox.php index 781179401..44508fe22 100644 --- a/scripts/initializeinbox.php +++ b/scripts/initializeinbox.php @@ -91,7 +91,7 @@ function initializeInbox($user) print "Initializing inbox for $user->nickname..."; } - $inbox = Inbox::staticGet('user_id', $user_id); + $inbox = Inbox::staticGet('user_id', $user->id); if ($inbox && !empty($inbox->fake)) { if (!have_option('q', 'quiet')) { @@ -104,7 +104,7 @@ function initializeInbox($user) print "SKIP\n"; } } else { - $inbox = Inbox::initialize($user_id); + $inbox = Inbox::initialize($user->id); if (!have_option('q', 'quiet')) { if (empty($inbox)) { print "ERR\n"; -- cgit v1.2.3-54-g00ecf