Bugfix: queries with retry=True return None when rate-limited

Because bool is a subclass of int, `isinstance(retry, int)` returns True and the
decrement results in retry=0, terminating the while loop. Patches 73a242d.