Limit no. of request retries to semantics API

* An infinite no. of retries hold up the worker and the only
way to get out of it is to restart the application. With a limit
on the maximum no. of retries, the worker will break the
while loop is this threshold is exceeded