Changeset d389947


Ignore:
Timestamp:
Dec 27, 2009, 12:04:28 AM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
f2adf6c
Parents:
4ae10de
git-author:
Nelson Elhage <nelhage@mit.edu> (12/23/09 14:22:27)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/27/09 00:04:28)
Message:
Print a better error message when we get ratelimited.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/BarnOwl/Module/Twitter/Handle.pm

    re4e1dcb rd389947  
    2929use BarnOwl;
    3030use BarnOwl::Message::Twitter;
     31use POSIX qw(asctime);
    3132
    3233sub fail {
     
    178179    if(exists($ratelimit->{remaining_hits})
    179180       && $ratelimit->{remaining_hits} <= 0) {
    180         $self->sleep($ratelimit->{reset_time_in_seconds} - time + 60);
    181         die("Twitter: ratelimited until " . $ratelimit->{reset_time} . "\n");
     181        my $timeout = $ratelimit->{reset_time_in_seconds};
     182        $self->sleep($timeout - time + 60);
     183        BarnOwl::error("Twitter" .
     184                       ($self->{cfg}->{account_nickname} ?
     185                        "[$self->{cfg}->{account_nickname}]" : "") .
     186                        ": ratelimited until " . asctime(localtime($timeout)));
    182187    } elsif(exists($ratelimit->{error})) {
    183188        $self->sleep(60*20);
Note: See TracChangeset for help on using the changeset viewer.