parq-app / parq-android

0 stars 0 forks source link

Ensure that spots are eventually freed if the user leaves the app while it's in the pre-nav state. #38

Closed kenzshelley closed 8 years ago

kenzshelley commented 8 years ago

What?

This PR ensure that if the user leaves the app while in the state immediately before navigation, the spot is eventually freed.

Why?

Obviously we don't want spots to be indefinitely reserved.

We don't want to free up the spot as soon as the user leaves the app because they could just be leaving for a short period of time -- e.g. they may be leaving the app to confirm the address they're going to, and intend on coming right back to start navigation. Thus, we wait for some set amount of time after they leave the app before we free the spot & set the app's state to FIND_SPOT (5 minutes right now).

Furthermore, we don't want to only free the spot in OnDestroy, because the user could theoretically leave the app (without killing it) and not come back for a really long time.

fixes #24

@matthewgrossman @nickcharles

matthewgrossman commented 8 years ago

I feel like we should eventually have some server functionality that does a quick sweep and frees up stale spots. What if the phone explodes before the 5 min timeout and never opens up the spot again.

This looks good tho

kenzshelley commented 8 years ago

@matthewgrossman Yeah that sounds like a good idea -- I know from experience that phone destruction happens....