Granola-Team / mina-indexer

The Mina Indexer is a re-imagined version of the software collectively called the "Mina archive node."
Apache License 2.0
19 stars 10 forks source link

Problem: scripts using mina-indexer must fork it only to wait for it #1203

Closed robinbb closed 2 months ago

robinbb commented 3 months ago

Scripts that use mina-indexer often want to have it ingest a bunch of block files in order to produce a working database. This includes our testing scripts. However, the indexer is nonresponsive during ingestion and the invoking script has no way to know that the Indexer has finished its ingestion other that to awkwardly poll for the existence of the Indexer's socket. This is a very poor user experience, and very error prone. (Is the right socket, or did another instance take over the socket? Did the indexer die, and it will never create the socket, causing infinite looping?) It requires writing more complex scripting logic than would be required to fix this inside the Indexer by simply exiting after ingestion if a certain command line option is given.

This is causing complexity in the testing code, and slowing down the improvements to our CI system and our developer experience.

Not only must the polling be implemented, but the Indexer process must be forked to the background, and then waited for, with useless logging (the polling code) occupying the console when the user is actually interested in the Indexer's output/log.

Adding this feature would yield a lot of value, and it is easy to add.

robinbb commented 3 months ago

Implement 'mina-indexer create-database'.

jhult commented 3 months ago

In implementing, we may no longer need this functionality: https://github.com/Granola-Team/mina-indexer/issues/1151