Skip to content

feat(indexer): graceful shutdown on SIGINT/SIGTERM#11442

Merged
tomxey merged 2 commits intodevelopfrom
sc-platform/indexer-graceful-shutdown
May 8, 2026
Merged

feat(indexer): graceful shutdown on SIGINT/SIGTERM#11442
tomxey merged 2 commits intodevelopfrom
sc-platform/indexer-graceful-shutdown

Conversation

@tomxey
Copy link
Copy Markdown
Contributor

@tomxey tomxey commented May 6, 2026

Description of change

Wire OS signals (Ctrl+C and SIGTERM) into the existing CancellationToken-based graceful shutdown of the data ingestion executor and JSON-RPC server. Previously the binary exited immediately, which could interrupt in-flight checkpoints mid-write.

A single master CancellationToken is created in main and threaded into both Indexer::start_writer_with_config (already accepted one) and Indexer::start_reader (new parameter, forwarded into build_json_rpc_server, replacing the token that function used to construct internally).

Mirrors the signal-handler pattern in iota-data-ingestion's main.

Links to any relevant issues

fixes #8819

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)

Infrastructure QA (only required for crates that are maintained by @iotaledger/infrastructure)

  • Synchronization of the indexer from genesis for a network including migration objects.
  • Restart of indexer synchronization locally without resetting the database.
  • Restart of indexer synchronization on a production-like database.
  • Deployment of services using Docker.
  • Verification of API backward compatibility.

Wire OS signals (Ctrl+C and SIGTERM) into the existing
CancellationToken-based graceful shutdown of the data ingestion
executor and JSON-RPC server. Previously the binary exited
immediately, which could interrupt in-flight checkpoints
mid-write.

A single master CancellationToken is created in main and threaded
into both Indexer::start_writer_with_config (already accepted one)
and Indexer::start_reader (new parameter, forwarded into
build_json_rpc_server, replacing the token that function used to
construct internally).

Mirrors the signal-handler pattern in iota-data-ingestion's main.

Closes #8819.
@tomxey tomxey self-assigned this May 6, 2026
@iota-ci iota-ci added infrastructure Issues related to the Infrastructure Team sc-platform Issues related to the Smart Contract Platform group. labels May 6, 2026
Copy link
Copy Markdown
Contributor

@sergiupopescu199 sergiupopescu199 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm ✨

Comment thread crates/iota-indexer/tests/common/mod.rs Outdated
Copy link
Copy Markdown
Contributor

@kodemartin kodemartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🌸

@tomxey tomxey marked this pull request as ready for review May 8, 2026 08:12
@tomxey tomxey requested a review from a team as a code owner May 8, 2026 08:12
@tomxey tomxey merged commit e069489 into develop May 8, 2026
46 checks passed
@tomxey tomxey deleted the sc-platform/indexer-graceful-shutdown branch May 8, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Issues related to the Infrastructure Team sc-platform Issues related to the Smart Contract Platform group.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(indexer): Use graceful shutdown capabilities of data ingestion worker in iota-indexer

4 participants