Closed andras3189 closed 1 year ago
@mendhak I created this request for #1025. Please could you check if this would be a good solution? If yes I also have some questions:
I've been testing this a little bit the past few days. I am trying to think if there is a simpler way to accomplish this same outcome, that doesn't involve creating jobs and cancelling them soon after. For example, what if before the job is even submitted, I check isNetworkAvailable, and then only submit the job if it's available. That will help reduce the disk writes and queueing checks.
Anyway overall I think this could work. I'll do some more testing. I'll push some commits straight to your branch with tweaks I need. I'll think on the wording too.
I noticed a side effect - when logging at every, for example, 5 seconds, if Point 1 is sent to a Custom URL and fails in that process, an error appears in the logs, like "failed, attempt 1 of 5" but when the next point comes around, that previous point gets discarded, so the next attempt never appears. That error message can be quite confusing, so I am thinking of setting the getRetryLimit to 1, if the 'discard offline' option is enabled. Or maybe it's OK like this.
Issue #1025
This change is to solve the following use case:
A new switch is added to the customurlsettings page. This is false by default. In this case everything works as before.
If the flag is set to true, old custom url log jobs tagged with 'Discardable' will be removed from the queue when a new job is created. This way when the network connection is restored, only one custom url log job will be in the queue which will contain the latest location.
This change does not affect in any way the auto-send to custom url (when a list of calls are made based on the csv file content). Jobs created for auto send are not tagged with 'Discardable' and won't be cancelled by the log jobs.