aloisdeniel / dio_retry

Retry interceptor for dio.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Retry callback bug

rodion-m opened this issue · comments

Hello! I found a bug with a retry callback. The module do only one call of given callback, after that it uses a default callback.
Here is a bugged code:
var shouldRetry = extra.retries > 0 && await extra.retryEvaluator(err);
to fix it we just have to change extra to options:
var shouldRetry = extra.retries > 0 && await options.retryEvaluator(err);

Thank you, I will fix that. :)

Thank you, I will fix that. :)

You are welcome and thank you for a useful module!

Sorry but when you release this fix on Pub?

var shouldRetry = extra.retries > 0 && await options.retryEvaluator(err);

where to change this

i have tried but the function api is nhi been
retries

on 404 it only retries only once

I fixed this in my branch by manually applying the PR. Here's how to use it in your project. You can use my patched version by adding this to your pubspec.yaml instead of the existing dio_retry package.

  dio_retry:
    git:
      url: https://github.com/lewcianci/dio_retry.git
      path: dio_retry

I also removed the dependency on logger in my fork. I prefer a more generic callback.

EDIT: I bit the bullet and published it to pub dev, you can grab it here if you want: https://pub.dev/packages/dio_retry_fixed

commented

@aloisdeniel any idea when you can get this fixed? Would be awesome to have it on prod