Fix retry behaviour

- retryCount wasn't being incremented, so maxRetries was never being reached
- Retrying would increase the delay before the next call. However this was not being reset back after a successful request.
- Keep the optimal delay value in config