Explorar o código

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 %!s(int64=12) %!d(string=hai) anos
pai
achega
0d0d006b36
Modificáronse 2 ficheiros con 5 adicións e 0 borrados
  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(BaseBackend):
             except (pycassa.InvalidRequestException,
                     pycassa.TimedOutException,
                     pycassa.UnavailableException,
+                    pycassa.AllServersUnavailable,
                     socket.error,
                     socket.timeout,
                     Thrift.TException) as exc:

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

@@ -33,11 +33,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):