Jaymon / morp

Python message passing wrapper around Amazon SQS
MIT License
1 stars 1 forks source link

Morp clear should catch and emit a WARNING on this error #9

Closed Jaymon closed 8 years ago

Jaymon commented 8 years ago

You can only request a clear every 60 seconds, Morp shouldn't fail though, clear should just emit a warning and return since this usually isn't fatal, even in testing

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/morp/message.py", line 139, in clear
    return cls.interface.clear(n)
  File "/usr/local/lib/python2.7/dist-packages/morp/interface/__init__.py", line 230, in clear
    self._clear(name, connection=connection)
  File "/usr/local/lib/python2.7/dist-packages/morp/interface/sqs.py", line 68, in _clear
    q.clear()
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/morp/interface/sqs.py", line 52, in queue
    self.raise_error(e)
  File "/usr/local/lib/python2.7/dist-packages/morp/interface/sqs.py", line 49, in queue
    yield q
  File "/usr/local/lib/python2.7/dist-packages/morp/interface/sqs.py", line 68, in _clear
    q.clear()
  File "/usr/local/lib/python2.7/dist-packages/boto/sqs/queue.py", line 400, in clear
    return self.purge()
  File "/usr/local/lib/python2.7/dist-packages/boto/sqs/queue.py", line 396, in purge
    return self.connection.purge_queue(self)
  File "/usr/local/lib/python2.7/dist-packages/boto/sqs/connection.py", line 124, in purge_queue
    return self.get_status('PurgeQueue', None, queue.id)
  File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 1227, in get_status
    raise self.ResponseError(response.status, response.reason, body)
InterfaceError: SQSError: 403 Forbidden
<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>AWS.SimpleQueueService.PurgeQueueInProgress</Code><Message>Only one PurgeQueue operation on Message is allowed every 60 seconds.</Message><Detail/></Error><RequestId>...</RequestId></ErrorResponse>