Add configurable limit for number of failures (stop when reached) GitOrigin-RevId: 56f0bf1d2e803851d68918b26f06d3b5834d7cc0