When the location changes there is a generated an file and send to the server. (A)
However there is also a process that sends all present files (not only tracker-info). (B)
These two a sometimes sending the files twice. For example when process A is sending but not yet has deleted the file. Then process B is started in the background and is sending the same file again.
I have a question. why does process B send that file? According to your logic, process A will delete the file after sending it.
If it is considered that process A may fail to send the file, you can specify a special filename when sending.
I would put a global variable Variable A = false, when procedure A is running it puts variable A = true, if procedure B finds variable A = true, it does nothing, and tries again as soon as Variable A goes back to False,
When the location changes there is a generated an file and send to the server. (A)
However there is also a process that sends all present files (not only tracker-info). (B)
These two a sometimes sending the files twice. For example when process A is sending but not yet has deleted the file. Then process B is started in the background and is sending the same file again.
Option 1 - use a database in your app and save each sent file name. Check this database before send each file.
Option 1 - on your server check every incoming file
I have a question. why does process B send that file? According to your logic, process A will delete the file after sending it.
If it is considered that process A may fail to send the file, you can specify a special filename when sending.
Correct. But the file hasn't been deleted when process B is started (from a timer). So process A is sending (and waiting for completion) when process B is started and finds the same file.
Option 1 - use a database in your app and save each sent file name. Check this database before send each file.
Option 1 - on your server check every incoming file
I like option 1 (as well as the true/false from Xfood) and go further with this.
Option 2 I don't like because then I'm still sending files twices which means the server is loaded more
Correct. But the file hasn't been deleted when process B is started (from a timer). So process A is sending (and waiting for completion) when process B is started and finds the same file.
My solution:
When the location changes, generate an file that is a special filename just for process A and process B ignores it .if you fail to send it then rename it for process B