Browse Source

Cassandra backend - catch pycassa.AllServersUnavailable exception

Catch the pycassa.AllServersUnavailable exception so the request is
retried. Without this the parent celery process freezes if this
exception is thrown. Fixes issue #1010.
Jared Biel 12 years ago
parent
commit
8427535f53
2 changed files with 5 additions and 0 deletions
  1. 1 0
      celery/backends/cassandra.py
  2. 4 0
      celery/tests/backends/test_cassandra.py

+ 1 - 0
celery/backends/cassandra.py

@@ -106,6 +106,7 @@ class CassandraBackend(BaseDictBackend):
             except (pycassa.InvalidRequestException,
                     pycassa.TimedOutException,
                     pycassa.UnavailableException,
+                    pycassa.AllServersUnavailable,
                     socket.error,
                     socket.timeout,
                     Thrift.TException), exc:

+ 4 - 0
celery/tests/backends/test_cassandra.py

@@ -34,11 +34,15 @@ def install_exceptions(mod):
     class TimedOutException(Exception):
         pass
 
+    class AllServersUnavailable(Exception):
+        pass
+
     mod.NotFoundException = NotFoundException
     mod.TException = TException
     mod.InvalidRequestException = InvalidRequestException
     mod.TimedOutException = TimedOutException
     mod.UnavailableException = UnavailableException
+    mod.AllServersUnavailable = AllServersUnavailable
 
 
 class test_CassandraBackend(AppCase):