Summary: Also add logic for recognising excessive timeouts. Refactor the code around timeouts a little. Reviewed By: artempyanykh Differential Revision: D18807836 fbshipit-source-id: df5a1b566