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

Replace new job with previous job with same JOB_TAG

Open hk4774 opened this issue 7 years ago • 1 comments

Is it possible to override the previous job by the new job? I'm using this library to sync data stored in offline with my server. The problem arises when I make a cron for syncing. It reflects duplicate data on the server. For the sake of uniqueness, I'm giving job tag as "XYZ job_unique id". So is there any way to replace the new job with duplicate job tag?

Thanks in advance.

hk4774 avatar Jun 16 '18 17:06 hk4774

Curreo there is no way to delete a job by id. If you are interested in adding that functionality as a pull request that would be fine. You can see how it would be done looking at the following section of code.

Make a new public method similar to queue.flushQueue() but have the method accept a job id and delete on id.

https://github.com/billmalarky/react-native-queue/blob/master/Models/Queue.js

If you add the functionality and pull request it I'll merge it in relatively quickly.

On Sat, Jun 16, 2018, 1:41 PM Harsh Kapadia [email protected] wrote:

Is it possible to override the previous job by the new job? I'm using this library to sync data stored in offline with my server. The problem arises when I make a cron for syncing. It reflects duplicate data on the server. For the sake of uniqueness, I'm giving job tag as "XYZ job_unique id". So is there any way to replace the new job with duplicate job tag?

Thanks in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/billmalarky/react-native-queue/issues/25, or mute the thread https://github.com/notifications/unsubscribe-auth/ABxTU2HtCtYDLoVGNrcKvSlOJKgmuUayks5t9UM3gaJpZM4Uqjn8 .

billmalarky avatar Jun 18 '18 14:06 billmalarky