Performance in spotty cell phone reception conditions
Opened this issue · 3 comments
Hey @CaptainSpam I use your app a lot and it's great! I have a couple of problems with it, and this is one of them: the performance of wiki submissions under spotty networking conditions.
I do Geohashing for fun, not so I can pore over and cultivate my wiki entries for hours after the fact, so whatever I do for the wiki, I do via the app.
As you can imagine, the most "interesting" expeditions for many will be deep in the wilderness, where cell phone reception is spotty at best, and that's the problem: wiki updates will often fail. I don't know how you implement it now, but here's a quick algorithm for how I think it should work:
- User submits an update
- All contents of the update are saved in a cache area (the picture, coordinates, message, any additional metadata)
- The app attempts to submit the update
- The app checks whether the update is completely sent and reflected on the wiki page
- Then and only then is the cache wiped
The delay between steps 3 and 5 could be hours and hours. The cache may get quite large (many many MB depending on the resolution of the photos and such). However, once reliable reception is reached they should be updated, including the coordinates at the time the update was first attempted (not the coordinates at the time of successful submission). Also, the logic has to deal with extremely variable networking conditions. For example, yesterday, while at the very crest of a ridge, I could get a couple of bars at 1x, but taking even 15 steps down the hill would kill reception entirely. Similarly, during the drive home, I would crest a hill and get reception for a few to a few tens of seconds, then lose it again as I descended into the next valley. The app needs to handle this appropriately without erroring out.
Alternately, there should be an "offline mode" where I can submit many updates, and the coordinates of the phone at the time the updates are written are cached, and then when I toggle "online mode" back on, the updates are sent, with the original coordinates/infobox overlay intact. Thanks!
Well, thing is, that's almost exactly how it should be acting now (apart from checking to make sure it was actually posted; I currently depend on the wiki's API to return a success code for that). In theory at least, if you try to submit an update, it'll try to post immediately, falling back to stashing it away in a queue for later if something goes wrong. Specifically, if it thinks there's no internet connection, it'll wait until it comes back and submit anything in the queue as soon as it can (it'll also throw up a notification if something like your login isn't right or whatnot). And, it should have an offline mode baked into it, where it'll just keep building up posts until it can release them.
But, like I said, that's purely in theory. Unfortunately, it turns out the mechanism I came up with to do that doesn't work the way I expected it to, especially if it's a long time between when the post was made and when the internet connection comes back (which, embarrassingly, is the specific reason I did that in the first place). Oops.
So, that's actually the next thing I'm working on fixing, after having been away from GHD development for a while. Hopefully I'll have something far more bulletproof once I'm done with it.
Thanks!
Awesome, glad you're grooming your backlog! Looking forward to more adventures in 2021, though I will admit the COVID Pandemic had me going on deep wilderness adventures almost daily.
There! Version 0.9.5 has been released (currently live in the releases section, pending approval and such on the Play Store). Hopefully that'll make wiki posting a lot more stable in spotty internet conditions. Let me know if something goes wrong!