1Net::Twitter::Role::RetUrsyeOrnECrornotrr(i3b)uted PerlNDeotc:u:mTewnittatteiro:n:Role::RetryOnError(3)
2
3
4
6 Net::Twitter::Role::RetryOnError - Retry Twitter API calls on error
7
9 version 4.01043
10
12 use Net::Twitter;
13 $nt = Net::Twitter->new(
14 traits => ['API::RESTv1_1', 'RetryOnError']
15 max_retries => 3,
16 );
17
19 Temporary errors are not uncommon when calling the Twitter API. When
20 applied to Net::Twitter this role will provide automatic retries of API
21 calls in a very configurable way.
22
23 It only retries when the response status code is >= 500. Other error
24 codes indicate a permanent error. If the maximum number of retries is
25 reached, without success, an exception is thrown, as usual.
26
28 This role adds the following options to "new":
29
30 initial_retry_delay
31 A floating point number specifying the initial delay, after an
32 error, before retrying. Default: 0.25 (250 milliseconds).
33
34 max_retry_delay
35 A floating point number specifying the maximum delay between
36 retries. Default: 4.0
37
38 retry_delay_multiplier
39 On the second and subsequent retries, a new delay is calculated by
40 multiplying the previous delay by "retry_delay_multiplier".
41 Default: 2.0
42
43 max_retries
44 The maximum number of consecutive retries before giving up and
45 throwing an exception. If set to 0, it the API call will be
46 retried indefinitely. Default 5.
47
48 retry_delay_code
49 A code reference that will be called to handle the delay. It is
50 passed a single argument: a floating point number specifying the
51 number of seconds to delay. By default, "sleep" in Time::HiRes is
52 called.
53
54 If you're using a non-blocking user agent, like Coro::LWP, you
55 should use this option to provide a non-blocking delay.
56
58 Marc Mims <marc@questright.com>
59
61 Copyright (c) 2016 Marc Mims
62
64 This library is free software and may be distributed under the same
65 terms as perl itself.
66
67
68
69perl v5.34.0 2022-01-21Net::Twitter::Role::RetryOnError(3)