Skip to content

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

@kgiusti

Description

@kgiusti

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions