softonic / axios-retry

Axios plugin that intercepts failed requests and retries them whenever possible
Other
1.9k stars 167 forks source link

Custom retry Condition with status 200? #117

Closed GsHeri closed 4 years ago

GsHeri commented 4 years ago

so i thought i could override the retry condition, but seems i was wrong. it works fine when i request a source that is not reachable. but if i poll a media service and wait for a file to be processed (which returns 200 with "state: 'processing'" or "state: 'processed'" this library seems to not react at all on a 200...?

const client = axios.create()
          axiosRetry(client, {
            retries: 3,
            retryCondition: res => res.data.state !== 'processed',
            retryDelay: axiosRetry.exponentialDelay,
          })

i've tried many different ways of writing that function, but it's just never even called on a 200.... why? how can i fix it?

mawrkus commented 4 years ago

Hi, seems your question is a duplicate of https://github.com/softonic/axios-retry/issues/100