Refactor WaitFor (#221)

* Refactor WaitFor

This commit modifies WaitFor in a few ways:

It replaces time.Now().Second() with time.Now().Unix() in order to
account for rolling minutes (for example, when WaitFor starts at 59
seconds, every timeout check will result in a negative number).

A "retry" timer has also been added. This will cause the predicate
to be retried every n seconds if there hasn't been a response. This
is to account for server or network issues that would cause the
predicate to be lost or hang indefinitely.

A combination of using both timeout and retry can be effective in
handling faulty requests as well as a master kill switch to stop.

* Remove Retry from WaitFor

This removes the retry parameter and re-uses the timeout to kill
possible hanging predicates.
2 files changed