blackducksoftware / hub-rest-api-python

HUB REST API Python bindings
Apache License 2.0
89 stars 104 forks source link

Only HTTPS GET is retried by the configurations in Retry class which is set by Client class and I am wondering why? #235

Closed koshmack closed 1 year ago

koshmack commented 1 year ago

I have encountered a retry issue where HTTPS requests sometimes retries but not always under network problems when using the Client class. Then I have found that the Client class instantiates the Retry class with only GET method allowed to retry.

    retry_strategy = Retry(
        total=int(retries),
        backoff_factor=2,  # exponential retry 1, 2, 4, 8, 16 sec ...
        status_forcelist=[429, 500, 502, 503, 504],
        allowed_methods=['GET']
    )

============= The default allowed methods are GET, PUT, DELETE and etc. in the Retry class. I’m wondering what is the reason for the Client class is overriding this default. Several sources say PUT and DELETE are idempotent as well as GET. Is there any reason for BD to cause unexpected results by retried PUT?

OffBy0x01 commented 1 year ago

That doesn't look right to me either - I can't think of any reason we'd want to only retry GET by default. I'd approve a PR removing this limitation.

koshmack commented 1 year ago

This issue is closed as the merged pull request https://github.com/blackducksoftware/hub-rest-api-python/commit/135606a4e47fc2231e916fbf465397a6f8de9042 has resolved this one.