Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic poll rate #143

Closed
Tracked by #409
lennet opened this issue Oct 6, 2019 · 2 comments
Closed
Tracked by #409

Dynamic poll rate #143

lennet opened this issue Oct 6, 2019 · 2 comments

Comments

@lennet
Copy link
Member

lennet commented Oct 6, 2019

We are currently updating the Apps content every 12 seconds or after the user send a message as it's using the same API. This may result in an outdated map especially if a request failed because we are currently waiting another 12 seconds for the next try at which point the app might already be in the background.

It would be nice to be smarter about updating the poll the data every 6 seconds if the app is in foreground and every 12 seconds in background (maybe as well in lower power/ data mode ?). Additionally we should retry sooner, if possible as soon as possible (maybe check for internet connection on iOS 12+ devices https://developer.apple.com/documentation/network/nwpathmonitor)

@i5glu
Copy link
Contributor

i5glu commented Oct 8, 2019

Hi, I would like to make this task, may I?

I have looked at RequestManager, so I think that we can poll the data every 6 seconds and for background update run application(_:performFetchWithCompletionHandler:) and BGAppRefreshTask (depends on iOS version). beginBackgroundTask(expirationHandler:) might also work, need some research here.

By the way method updateData() might be wrapped to asynchronous operation. It seems that it would be easier to control update, when we have queue.

What do you think, @lennet ?

@lennet
Copy link
Member Author

lennet commented Oct 8, 2019

HI @iglushchuk ,
Thanks for contributing! Sure you can takeover the task.

We are using GPS updates for background scheduling so we don't need BGAppRefreshTasks as far as I know.

I though about changing the Timer fire rate but an Operation Queue also sounds like a good solution but requires more refactoring.
When implementing the operation, keep in mind that we only want to send the most current location to the backend so if a request failed we shouldn't retry with the old location data

@mltbnz mltbnz mentioned this issue Oct 21, 2021
18 tasks
@mltbnz mltbnz closed this as completed Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants