The number of pending commands can be wrong when some commands fail, this counter is not decremented.
This makes the indexing state wrong it will be stuck as "Indexing in progress".
This happens for instance when an async indexing command is done while the document has been removed.
The following trace can be seen in the logs:
This counter and the state must be reliable.