Explorar o código

Don't increment the prefetch count for ETA tasks if there's no prefetch count already set

Ask Solem %!s(int64=14) %!d(string=hai) anos
pai
achega
e75ec6e602
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      celery/worker/listener.py

+ 4 - 2
celery/worker/listener.py

@@ -114,11 +114,13 @@ class QoS(object):
 
 
     def increment(self):
     def increment(self):
         """Increment the current prefetch count value by one."""
         """Increment the current prefetch count value by one."""
-        return self.set(self.value.increment())
+        if int(self.value):
+            return self.set(self.value.increment())
 
 
     def decrement(self):
     def decrement(self):
         """Decrement the current prefetch count value by one."""
         """Decrement the current prefetch count value by one."""
-        return self.set(self.value.decrement())
+        if int(self.value):
+            return self.set(self.value.decrement())
 
 
     def decrement_eventually(self):
     def decrement_eventually(self):
         """Decrement the value, but do not update the qos.
         """Decrement the value, but do not update the qos.