GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Twitter::API::Trait::RetryOnError(3) User Contributed Perl Documentation Twitter::API::Trait::RetryOnError(3)

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

version 1.0006

    use Twitter::API;

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

    my $statuses = $client->home_timeline;

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.

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

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

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.

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

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) }

Marc Mims <marc@questright.com>

This software is copyright (c) 2015-2021 by Marc Mims.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2021-04-01 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.