Open robinbb opened 1 week ago
Relates to #728 and #1203
Some findings. The culprit for not being able to interrupt initial block ingestion is that the parsing functions for blocks and staking ledgers was using blocking I/O rather than tokio's future based I/O. Fixing this issue is relatively straight forward but we still have a chicken and egg problem with graceful shutdown. The way the indexer is coded now, a catching SIGINT during ingestion wouldn't hit any of our shutdown code because it hasn't been initialized yet.
Cancelling during ingestion yields this error
Error: shutdown timed out
Stack backtrace:
0: std::backtrace::Backtrace::capture
1: mina_indexer::main
2: std::sys_common::backtrace::__rust_begin_short_backtrace
3: _main
With the newly discussed design, this amounts to being able to interrupt the non-server command 'create-database'. May be an easier problem to solve.
One cannot send a shutdown message during ingestion because there is no socket. Sending a signal does not work, either, because it is ignored or mis-handled.