oknozor / musicbrainz_rs

A wrapper around the musicbrainz API
MIT License
38 stars 18 forks source link

feat(): implement auto-retries #46

Closed ritiek closed 3 years ago

ritiek commented 3 years ago

This PR adds an auto-retry feature if a request fails due to being rate-limited by MusicBrainz servers. By default; every failed request will automatically be retried twice. This number can be changed by calling:

musicbrainz_rs::config::set_default_retries(3);

I've also removed the 1s sleep from all our tests, and our test-suite now runs much faster (~2 mins now, while it used to take ~3.5 mins previously!).

Closes #13.

ritiek commented 3 years ago

ee there's stuff failing here, i'll check what's up.

ritiek commented 3 years ago

ee there's stuff failing here, i'll check what's up.

Ok. I fixed the clippy warning and it seems like MusicBrainz servers can sometimes return a lower retry-after header value than what the actual value is. I inserted a comment in the code covering about this.

ritiek commented 3 years ago

Rebased.