logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Twitter::API::Trait::RetryOnError - Automatically retry API calls on error

Attributes

initial_retry_delay
       Amount of time to delay before the initial retry. Specified in fractional seconds. Default: 0.25 (250ms).

   max_retry_delay
       Maximum delay between retries, specified in fractional seconds. Default: 4.0.

   retry_delay_multiplier
       After the initial delay, the delay time is multiplied by this factor to progressively back off allowing
       more time for the transient condition to resolve. However, the delay never exceeds "max_retry_delay".
       Default: 2.0.

   max_retries
       Maximum number of times to retry on error. Default: 5.

   retry_delay_code
       A coderef, called to implement a delay. It takes a single parameter, the number of seconds to delay.
       E.g., 0.25. The default implementation is simply:

           sub { Time::HiRes::sleep(shift) }

Author

       Marc Mims <marc@questright.com>

Description

       With this trait applied, Twitter::API automatically retries API calls that result in an HTTP status code
       of 500 or greater. These errors often indicate a temporary problem, either on Twitter's end, locally, or
       somewhere in between.  By default, it retries up to 5 times. The initial retry is delayed by 250ms.
       Additional retries double the delay time until the maximum delay is reached (default: 4 seconds).
       Twitter::API throws a "Twitter::API::Error" exception when it receives a permanent error (HTTP status
       code below 500), or the maximum number of retries has been reached.

       For non-blocking applications, set a suitable "retry_delay_code" callback.  This attribute can also be
       used to provided retry logging.

Name

       Twitter::API::Trait::RetryOnError - Automatically retry API calls on error

Synopsis

           use Twitter::API;

           my $client = Twitter::API->new_with_options(
               traits => [ qw/ApiMethods RetryOnError/ ],
               %other_optons
           );

           my $statuses = $client->home_timeline;

Version

       version 1.0006

See Also