celery / kombu

Messaging library for Python.
http://kombu.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
2.82k stars 922 forks source link

autoretry fails to honor max_retries if connection cannot be established #829

Open kgiusti opened 6 years ago

kgiusti commented 6 years ago

If max_retries is passed to connection.autoretry() and the connection is not available then autoretry blocks until a connection is made regardless of the max_retries value.

See attached. If you set a bogus url (results in connection refused) you will see that the revive of the default channel is never passed the original value of max_retries.

$ python ./test.py /home/kgiusti/work/kombu/kombu/connection.py(487)_ensured() -> got_connection = 0 (Pdb) bt /home/kgiusti/work/kombu/test.py(42)() -> ret, channel = arm() /home/kgiusti/work/kombu/kombu/connection.py(487)_ensured() -> got_connection = 0 (Pdb) p max_retries 5 (Pdb) cont /home/kgiusti/work/kombu/kombu/utils/functional.py(330)retry_over_time() -> interval_range = fxrange(interval_start, (Pdb) bt /home/kgiusti/work/kombu/test.py(42)() -> ret, channel = arm() /home/kgiusti/work/kombu/kombu/connection.py(487)_ensured() -> got_connection = 0 /home/kgiusti/work/kombu/kombu/connection.py(571)call() -> self.revive(self.connection.default_channel) /home/kgiusti/work/kombu/kombu/connection.py(833)default_channel() -> self.ensure_connection(**conn_opts) /home/kgiusti/work/kombu/kombu/connection.py(406)ensure_connection() -> callback) /home/kgiusti/work/kombu/kombu/utils/functional.py(330)retry_over_time() -> interval_range = fxrange(interval_start, (Pdb) p max_retries None (Pdb) test.py.gz

auvipy commented 4 years ago

hope this is fixed by 4.6.x? if not please ping here. sorry for not able to reply earlier.