Closed hannojg closed 3 years ago
First of all that's a exemplary PR description :+1: :-). The changes look good to me so far, just the marked function should be renamed since the naming could be missleading.
I think maybe we should mark all jobs as failed which are active before the queue is started in future. But this can be done in another PR.
closed because of https://github.com/SimonErm/react-native-job-queue/pull/27
Following use case:
Without the fixes in this PR however, the job would never get restarted and still be marked as active forever in the database. The implementation in this PR mark the jobs that are active but considered timed out as failed, so that when the queue starts the job can be retried.
maybe we should add a note to the docs, that the jobs should be idempotent, like here.
I also updated the UI of the example app. To reproduce the issue:
This PR also exposes two other issues:
Promise.race
the executer promise doesn't get cancelled which can lead to strange results2
attempts. However, the lib runs the job 3-4 times. These issues should be fixed in another PR: