[milo] cap getPrevRev recursive call
[milo] cap getPrevRev recursive call

When switching LUCI to prod, we also bump next build number. This causes
buildstore.getPrevRev fall into the slowest code path where it recursively
goes back by build numbers trying to find prev build, which takes a lot of
time if the build number was bumped by a large number (1000x),
and ultimately fails with the request timeout.

Cap getPrevRev recursion.

Bug: 793514
Change-Id: Ifca3db1d89b7c82b8643c02f39d9ceebdc736dd0
Reviewed-on: https://chromium-review.googlesource.com/830274
Commit-Queue: Nodir Turakulov <ef4933a197ef7b4b3f55f1bec4942aead3637a2a@chromium.org>
Reviewed-by: Robbie Iannucci <40f3d43a28ebae3cb819288542e1c84d73d962d5@chromium.org>
Reviewed-by: Erik Staab <9e0728822fdb2ce07b011b42510312bb837e6a51@chromium.org>

luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go