(plugin) network::cisco::meraki::cloudcontroller::restapi - handle limit gracefully (#3919)

This commit is contained in:
qgarnier 2022-09-26 10:52:15 +02:00 committed by GitHub
parent 32e8712aa5
commit e4c7f13446
1 changed files with 3 additions and 1 deletions

View File

@ -189,7 +189,9 @@ sub request_api {
return undef if (defined($options{ignore_codes}) && defined($options{ignore_codes}->{$code}));
if ($code == 429) {
sleep(1);
my ($retry) = $self->{http}->get_header(name => 'Retry-After');
$retry = defined($retry) && $retry =~ /^\s*(\d+)\s*/ ? $retry : 1;
sleep($retry);
next;
}