2

I'm using Square's Tape library to persist HTTP Request Tasks to disk so that if I make a request and it fails due to things like network errors or server issues, the request won't be lost and can be tried again later.

Is there a recommended strategy for removing "bad" tasks from the ObjectQueue? I can imagine a possible scenario where you create a malformed HTTP request task, add it to the task queue, and then try to process it in a service like in the tape-sample code. Because the request is malformed (or maybe the service its trying to hit has been retired), the request never succeeds and the request just kinda sits in the queue forever blocking further added requests from ever being processed. I suppose one option could be to keep track of the number of failed attempts for the head task.

Kevin Brey
  • 1,233
  • 1
  • 12
  • 18
Matthew
  • 6,356
  • 9
  • 47
  • 59
  • Did you find a solution for this? This is the main thing stopping me from trying out the tape library in my projects. – Catalin Morosan Jul 01 '14 at 06:45
  • 2
    I would just recommend going with https://github.com/path/android-priority-jobqueue. It has a lot of extra functionality for dealing wit h this kind of stuff. – Matthew Jul 01 '14 at 16:37
  • Wow. This library seems great. Thanks a lot for this tip. I will definitely try it out in my current project. – Catalin Morosan Jul 02 '14 at 06:26
  • For tape, we do something similar to what you suggested. Count the number of failed attempts of the head task, and remove it on a certain number of failures. Additionally we recognize if the error is say a network error, and don't increase the count if so. Looking back I would have just used an alternative library, but since we had tape handling many of our other tasks, I decided to go the route where we basically are writing code to manage the queue. – KG - Sep 08 '14 at 18:37
  • Is there any alternative other than https://github.com/path/android-priority-jobqueue ? Not that I don't want to use it, I just want to know my options :) – Papipo Nov 21 '14 at 00:23

0 Answers0