Skip to content

Reset last proactive request date before sending request.#1990

Closed
Woildan wants to merge 0 commit into
mapbox:masterfrom
Mappy:proactive-last-location-date
Closed

Reset last proactive request date before sending request.#1990
Woildan wants to merge 0 commit into
mapbox:masterfrom
Mappy:proactive-last-location-date

Conversation

@Woildan
Copy link
Copy Markdown
Contributor

@Woildan Woildan commented Feb 22, 2019

Another fix I have in my codebase that I didn't contribute back until now.

The problem occurs when you have a server that takes more than a second to return a response to a proactive route update request (slow server or slow network).

When the next CoreLocation update is delivered to the route controller, if the pre-conditions are still met in didUpdateLocations, checkForFasterRoute gets called again, the elapsed time is still > to RouteControllerProactiveReroutingInterval, getDirections is called, previous request is cancelled, new one is sent.

As a result, when a proactive request is sent, another one will be sent every second until the server is able to send a response in less than a second.

Reseting the last update date before sending the request avoids re-sending a request before a full RouteControllerProactiveReroutingInterval seconds passes.

@frederoni
Copy link
Copy Markdown
Contributor

frederoni commented Feb 25, 2019

Thank you for your contributions.

We implemented a similar fix in #1986 in particular 346c2c8. It also avoids interrupting a regular reroute and vice versa in both route controllers. Would you mind taking a look at it and let us know if it fixes your problem?

@Woildan
Copy link
Copy Markdown
Contributor Author

Woildan commented Feb 27, 2019

After a quick look at your code it looks like it should fix my problem.
I'll test properly when I get a moment and let you know, probably on Friday.

@Woildan Woildan force-pushed the proactive-last-location-date branch from d63f365 to f7a650c Compare March 8, 2019 15:09
@Woildan Woildan closed this Mar 8, 2019
@Woildan Woildan force-pushed the proactive-last-location-date branch from f7a650c to c950c2f Compare March 8, 2019 15:30
@Woildan
Copy link
Copy Markdown
Contributor Author

Woildan commented Mar 8, 2019

Fix looks good, I'm throwing my branch away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants