Net::T...nError(3pm)
π NAME π
Net::Twitter::Role::RetryOnError β bestie, this is the role that says "okay that call failed but likeβ¦ try again?" to the Twitter API π¦
β¨ VERSION β¨
version 4.01043 β yes she's got a number and she's proud of it π
π SYNOPSIS π
use Net::Twitter;
$nt = Net::Twitter->new(
traits => ['API::RESTv1_1', 'RetryOnError']
max_retries => 3,
);
look at her go. literally just plug the trait in and let her cook π
πΈ DESCRIPTION πΈ
okay so real talk: calling the Twitter API, temporary errors just happen. not a vibe, not your fault, just the universe being messy π. Slap this role onto Net::Twitter and you get automatic retries of your API calls, and it's super configurable β you're the main character here, you decide everything.
The way that it only retries when the response status code is >= 500?? That's the whole rule. Any other error code is giving permanent error, so she won't waste your time retrying it, periodt. And if she hits the maximum number of retries and still hasn't succeeded? An exception gets thrown, as usual. No cap, that's just how it is π
π₯ OPTIONS π₯
This role adds these options to new, so go off bestie:
initial_retry_delayβ a floating point number, it's the initial delay after an error and before retrying. Default:0.25(that's 250 milliseconds, iykyk β±οΈ)max_retry_delayβ a floating point number, the maximum delay between retries. Default:4.0retry_delay_multiplierβ on the second retry and every one after that, a new delay gets calculated by multiplying the previous delay byretry_delay_multiplier. Default:2.0(she grows fast π±)max_retriesβ the maximum number of consecutive retries before she gives up and throws an exception. And listen: if you set it to0, the API call will be retried indefinitely π. Default5.retry_delay_codeβ a code reference that gets called to handle the delay. She's passed a single argument: a floating point number with the number of seconds to delay. By default,sleepinTime::HiResis called.
real talk for the async girlies: if you're using a non-blocking user agent, like Coro::LWP, you should use this option to provide a non-blocking delay. don't block the whole vibe β
π AUTHOR π
Marc Mims <marc@questright.com> β icon, legend, the moment π
π COPYRIGHT π
Copyright (c) 2016 Marc Mims
π LICENSE π
This library is free software and may be distributed under the same terms as perl itself. slay, share her with the world π«Ά
and that's the whole page bestie!! she's from perl v5.34.0, dated 2022-06-16, and her manual name is Net::T...nError(3pm) β go forth and retry responsibly β¨π
π¦ where this page comes from
- debian bookworm: libnet-twitter-perl 4.01043-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-twitter-perl 4.01043-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-twitter-perl 4.01043-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms