Explorar o código

prefetch_count can't be less than 1 if prefetch count set, and should not be decremented if prefetch count is disabled (0).

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

+ 2 - 2
celery/worker/listener.py

@@ -117,12 +117,12 @@ class QoS(object):
 
     def increment(self):
         """Increment the current prefetch count value by one."""
-        if int(self.value):
+        if int(self.value) > 0:
             return self.set(self.value.increment())
 
     def decrement(self):
         """Decrement the current prefetch count value by one."""
-        if int(self.value):
+        if int(self.value) > 1:
             return self.set(self.value.decrement())
 
     def decrement_eventually(self):