X-Git-Url: http://git.squeep.com/?p=awsible;a=blobdiff_plain;f=sqs-action.py;h=a71d01d003620f8817793737bf6372d61758728c;hp=54f2eb7969cd48b4a879eeac8829dc4315d85b84;hb=8dcd3b6e1c6e58c150917843204eff607ad15e97;hpb=164fb4ac7aebf84ca89433aeee8d16771fb8b7da diff --git a/sqs-action.py b/sqs-action.py index 54f2eb7..a71d01d 100755 --- a/sqs-action.py +++ b/sqs-action.py @@ -43,6 +43,7 @@ def handleEvent(message, event, ASGName, InstanceId): message.delete() else: notice += ['no action taken: no playbook for this ASG'] + message.delete() notify(notice[0], '\n'.join(notice)) @@ -62,12 +63,13 @@ def processMessage(message): instanceState = ec2r.Instance(InstanceId).state['Name'] except: logging.debug('instance %s does not exist', InstanceId) - message.delete() + message.change_visibility(VisibilityTimeout=60 * 2) else: if instanceState == 'running': handleEvent(message, event, ASGName, InstanceId) else: logging.debug('instance %s is in state %s, will try again', InstanceId, instanceState) + message.change_visibility(VisibilityTimeout=60 * 2) else: logging.debug('nothing to do for event %r', data) message.delete()