Browse Source

celery.task.control.broadcast: Set reply limit to number of destinations (if specificed)

Ask Solem 14 years ago
parent
commit
8ad62962df
1 changed files with 7 additions and 0 deletions
  1. 7 0
      celery/task/control.py

+ 7 - 0
celery/task/control.py

@@ -110,6 +110,13 @@ def broadcast(command, arguments=None, destination=None, connection=None,
     arguments = arguments or {}
     reply_ticket = reply and gen_unique_id() or None
 
+    if destination is not None and not isinstance(destination, (list, tuple)):
+        raise ValueError("destination must be a list/tuple not %s" % (
+                type(destination)))
+
+    # Set reply limit to number of destinations (if specificed)
+    if limit is None and destination:
+        limit = destination and len(destination) or None
 
     broadcast = BroadcastPublisher(connection)
     try: