From e4c7f13446962fba236917029fbeb7fc9cf15797 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Mon, 26 Sep 2022 10:52:15 +0200 Subject: [PATCH] (plugin) network::cisco::meraki::cloudcontroller::restapi - handle limit gracefully (#3919) --- .../cisco/meraki/cloudcontroller/restapi/custom/api.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/centreon-plugins/network/cisco/meraki/cloudcontroller/restapi/custom/api.pm b/centreon-plugins/network/cisco/meraki/cloudcontroller/restapi/custom/api.pm index d446d6a8f..0eb3daecc 100644 --- a/centreon-plugins/network/cisco/meraki/cloudcontroller/restapi/custom/api.pm +++ b/centreon-plugins/network/cisco/meraki/cloudcontroller/restapi/custom/api.pm @@ -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; }