X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=sqs-action.py;h=a71d01d003620f8817793737bf6372d61758728c;hb=588872ef49cb75a5ffa775e738ae3c61f9d7bad0;hp=54f2eb7969cd48b4a879eeac8829dc4315d85b84;hpb=164fb4ac7aebf84ca89433aeee8d16771fb8b7da;p=awsible 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()