Bug with query.hasNext()

I agree, it looks like a bug has been introduced into hasNext(). I have similar coding which has been working correctly for over two years, and it suddenly failed last Friday 30 June, with the inevitable “Too Many Requests”. A work-around using a limit on the number of times round the loop has got it working again.