retryWhen/repeatWhen

Rebase and clean up of #1326 while Aaron is at LambdaJam.