react-native-job-queue icon indicating copy to clipboard operation
react-native-job-queue copied to clipboard

How can i re try a job that has been failed ? ( basically persisting the job and re trying it when app is back online or re opened)

Open Udit-takkar opened this issue 2 years ago • 4 comments

i have to upload an image to server but if the device looses connection then it should persist the task and then retry it again when app comes back online or app is re started by the user. How can i do this?

Udit-takkar avatar Mar 22 '22 09:03 Udit-takkar

You can implement this by using react-native-netinfo to get the connection state. Just configure an onFailure callback which adds the failed job again with startQueue flag set to false and attemts set to 0. Than you just have to call queue.start() if the connection state listener of react-native-netinfo is called. https://github.com/SimonErm/react-native-job-queue/issues/37 https://github.com/SimonErm/react-native-job-queue/issues/31

SimonErm avatar Mar 30 '22 18:03 SimonErm

@SimonErm thanks

Udit-takkar avatar Jul 06 '22 20:07 Udit-takkar

You can implement this by using react-native-netinfo to get the connection state. Just configure an onFailure callback which adds the failed job again with startQueue flag set to false and attemts set to 0. Than you just have to call queue.start() if the connection state listener of react-native-netinfo is called. #37 #31

@SimonErm tried this . not working it goes into infinte loop if request fails even though i am passing flag as false.

Udit-takkar avatar Jul 27 '22 17:07 Udit-takkar

Can you provide a code example to reproduce?

SimonErm avatar Aug 02 '22 22:08 SimonErm

I close this because of inactivity

SimonErm avatar Dec 19 '23 17:12 SimonErm