A generic promised based retry mechanism. Useful for eg. ensuring an available database or message queue connection