Explorar el Código

swap order of detection for protocols (#4357)

we detected that during cycles between celery 3.1.25 and celery 4.1.0 workers, a message returning from a celery 4.1.0 worker crashes 3.1.25 workers with an unrecoverable error due to "hybrid" messages.
Russell Keith-Magee hace 7 años
padre
commit
0128d5a932
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      celery/worker/consumer.py

+ 2 - 2
celery/worker/consumer.py

@@ -450,10 +450,10 @@ class Consumer(object):
         def on_task_received(body, message):
             headers = message.headers
             try:
-                type_, is_proto2 = headers['task'], 1
+                type_, is_proto2 = body['task'], 0
             except (KeyError, TypeError):
                 try:
-                    type_, is_proto2 = body['task'], 0
+                    type_, is_proto2 = headers['task'], 1
                 except (KeyError, TypeError):
                     return on_unknown_message(body, message)