Indexer Fetcher Implementation

I am trying to read the implementation of the indexer but I am not familiar with the Go language.

In, once caught up, how does the indexer know that a new block has been added? Line 136 comment is
// wait for algod to notify of a new round, then fetch that block
but I don’t see in the code where this is happening. Line 194 has a sleep call so is it correct that the indexer is just waiting 5 seconds each time and then querying to see if there is a new block?


The indexer uses the StatusAfterBlock REST API call:

which is also what is used in general for waiting for confirmation of a block in the developer API documentation

I see, thanks for the explanation. What is the purpose of the sleeping for 5 seconds on line 194? Is it a timeout to see if the indexer recovers from an error from failing to fetch the next block?