From 324cea074d91baabb330cc4a50617e41413a32eb Mon Sep 17 00:00:00 2001 From: Dave North Date: Tue, 25 Sep 2018 11:05:33 -0400 Subject: [PATCH] Handle throughput exception --- src/aws-target-group-cleanup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aws-target-group-cleanup.py b/src/aws-target-group-cleanup.py index 0b35d93..0f44148 100644 --- a/src/aws-target-group-cleanup.py +++ b/src/aws-target-group-cleanup.py @@ -2,10 +2,11 @@ import sys import boto3 import argparse import pprint - +from time import sleep def remove_target_group(arn, elb_client): request_id = None + response = None try: response = elb_client.delete_target_group( @@ -13,6 +14,7 @@ def remove_target_group(arn, elb_client): ) except Exception as e: print("Error removing target group " + arn + " (" + str(e) + ")") + sleep(0.5) # We could be throttled so we will delay here if so... if response: if response['ResponseMetadata']['HTTPStatusCode'] == 200: