phylotastic / Pt_Mobile_Application

Mobile Application for Phylotastic Project
2 stars 0 forks source link

timeout and exit #72

Closed arlin closed 8 years ago

arlin commented 8 years ago

If OpenTree does not return a result within X seconds, exit and alert the user: "Sorry! We did not get a response in X seconds. Please wait and try again later."

The value of X should be chosen as a balance between (1) giving OpenTree enough time to respond and (2) not annoying the user with a long wait. I would suggest X = 15 s.

thanhnh-infinity commented 8 years ago

I implemented time-out for iOS Application when app made request to Open Tree.

BTW, I figured it out the problem for 34 species names that you cannot see the Tree result. It is not issue of Open Tree, Open Tree returned a Tree. The problem is that, because the result tree of Open Tree is huge and jsphylosvg cannot render the Tree visualization (Because in app right now, I used jsphylogsvg library to render the Tree visualization)

I attach here the request to Open Tree. I guess that this problem can be solved when Abu makes change to use induced_subtree instead of subtree function

Request : http://phylo.cs.nmsu.edu:5004/phylotastic_ws/gt/ot/get_tree?taxa=Zonotrichia%20capensis|Tangara|Tangara%20nigroviridis|Diglossa%20glauca|Diglossa%20brunneiventris|Catamenia%20analis|Coninostrum%20cinereum|Spinus%20magellanicus|Spinus%20crassirostris|Sitta%20carolinensis|Microcerculus%20marginatus|Thryomanes%20bewickii|Henicorhina%20leucophrys|Pheugopedius%20eisenmanni|Pheugopedius%20genibarbis|Cantorchilus%20superciliaris|Cyphorhinus%20thoracicus|Cyphorhinus%20arada|Cinnycerthia%20peruana|Cinnycerthia%20olivascens|Troglodytes%20solstitialis|Troglodytes%20aedon|Troglodytes%20hiemalis|Cistothorus%20palustris|Campylorhynchus%20fasciatus|Myadestes%20ralloides|Turdus%20fuscater|Turdus%20ignobilis|Turdus%20leucops|Entomodestes%20leucotis|Catharus%20fuscater|Catharus%20dryas|Cinclus%20leucocephalus|Mino%20dumonti|Orochelidon%20murina|Pygochelidon%20cyanoleuca|Atticora%20tibialis|Corvus%20cornix

You can easily test this request with your browser, and you can see the huge tree

Moreover, in future, if we want to display a huge tree, I think we should determine another Tree Visualization instead of jsphylosvg. May be the library that Van used in portal.

ducvan0212 commented 8 years ago

Efficiency is exactly the reason why I had to look for d3 for visualization instead of just being plug-and-play as in case of phylojs.

arlin commented 8 years ago

FYI, the tree has over 8000 tips. So, I would call that a "huge" tree for purposes of visualization. We should be able to support effective viewing of trees with dozens of species in the mobile app, and we should be able to support viewing trees with hundreds of species in the web portal.

Yes, @thanhnh-infinity, the problem is that phylo.cs.nmsu.edu is not making the correct query to OpenTree for the induced subtree, i.e., the problem is phylotastic/phylo_webservices#12 . @abusalehmdtayeen, could you make it a priority to fix that? We can't distribute the mobile app until we fix this problem.

abusalehmdtayeen commented 8 years ago

@arlin: yes, I would fix that today.

thanhnh-infinity commented 8 years ago

Hi @abusalehmdtayeen @arlin : I think iOS app works well right now. We can see the tree

arlin commented 8 years ago

We need to find a test case for this. Maybe some dinosaur names?

arlin commented 8 years ago

I can't find a case that makes OpenTree time-out. I tried dinosaurs but what happens in this case is that OpenTree immediately returns the result that there is no information.

thanhnh-infinity commented 8 years ago

Maybe you should use very slow network

thanhnh-infinity commented 8 years ago

I tried to test this feature by this way:

  1. Open app and take a picture
  2. Get the list
  3. Go to the list and Click View Tree, waiting Open Tree dialog will appear
  4. Very quick to turn off Wifi or 4G on IPhone / Or unplug my Wifi router.
  5. Waiting for end of timeout and saw the message.
arlin commented 8 years ago

Good idea, @thanhnh-infinity. I verified that this works, but it happens very quickly. I was getting the "try again" error after about 7 seconds. What waiting time are you using?

thanhnh-infinity commented 8 years ago

Hi @arlin , because in the newest version, app can automatically detect no network and display warning message immediately when network is not connected. It means when you turn off Wifi or 4G, app will warn you.

arlin commented 8 years ago

OK, good. I'm closing this.