I am making a post from android to php with data and an image. I'm scaling the image down in android and base 64 encoding it. When it is sent via volley, most images are somewhere between 70 and 100kbs. The problem I have is that a few images for whatever reasons come out to be slightly bigger, like 130kbs. At 130kbs, the volley doesn't get a response soon enough and send the request again, creating multiple entries on my database. 30Kb's seems like a very small window, so I need to put a safety measure in place to prevent multiple entries.
I'm not sure what the best approach to solving this problem is. Is there a way to extend the initial wait period in volley? Can I handle the decoding of the image and saving on the php server asynchronously so not to slow down the response? Should I do a check to make sure the incoming request is not a duplicate?
Please let me know what you think the best solution is and why.