Merge pull request #8 from logos-blockchain/erhant/pre-release-fixes

fix: better graceful shutdown + bump flakes to `main`
This commit is contained in:
erhant 2026-06-23 19:37:00 +03:00 committed by GitHub
commit 061019c079
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 39 additions and 20 deletions

2
.gitignore vendored
View File

@ -5,4 +5,4 @@ build
lez-explorer-ui-*-lgx-*
# ignore rocksdb (may appear here during indexer tests)
rocksdb*
rocksdb*

24
flake.lock generated
View File

@ -21,16 +21,16 @@
"logos-module-builder": "logos-module-builder_4"
},
"locked": {
"lastModified": 1782142627,
"narHash": "sha256-IZslE6yROAxl/FpjlEeZRc+vHKc/1M7kIFvRlgWqDIQ=",
"ref": "erhant/migr-to-logos-module-builder-update-LEZ",
"rev": "014a6dcfe1f5b2529024e8e0fa659e0c546f8652",
"revCount": 42,
"lastModified": 1782229998,
"narHash": "sha256-SmYzzRGT239/hXnBdUldILvcCdObeNufvUPJLopOCKM=",
"ref": "main",
"rev": "385c0ce6a042eb9b211dbd95bd0f9ee94864f148",
"revCount": 52,
"type": "git",
"url": "https://github.com/logos-blockchain/lez-indexer-module"
},
"original": {
"ref": "erhant/migr-to-logos-module-builder-update-LEZ",
"ref": "main",
"type": "git",
"url": "https://github.com/logos-blockchain/lez-indexer-module"
}
@ -2013,16 +2013,16 @@
"rust-rapidsnark": "rust-rapidsnark"
},
"locked": {
"lastModified": 1782142589,
"narHash": "sha256-K5NtBontpPx1XqnX6jbEzPXSchaLbPlG9689W+C/ExA=",
"ref": "erhant/fix-indexer-ffi",
"rev": "2a78b1b3d1b4080930c00ecf23b5c0e73cd646b8",
"revCount": 2773,
"lastModified": 1782219627,
"narHash": "sha256-mF9P5483XSGudP69VWlCeRTYFocklDwHGvPNujnDxTM=",
"ref": "main",
"rev": "a9df90c5b655446708395c99f627834eb822c48d",
"revCount": 2790,
"type": "git",
"url": "https://github.com/logos-blockchain/logos-execution-zone"
},
"original": {
"ref": "erhant/fix-indexer-ffi",
"ref": "main",
"type": "git",
"url": "https://github.com/logos-blockchain/logos-execution-zone"
}

View File

@ -4,11 +4,8 @@
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
# NOTE: git+https (not github:) because the branch name contains a slash —
# the github: fetcher mis-routes slashed refs through the commits API (404).
# TODO: repoint to the merge target once this branch lands / goes public.
lez_indexer_module.url = "git+https://github.com/logos-blockchain/lez-indexer-module?ref=erhant/migr-to-logos-module-builder-update-LEZ";
lez_indexer_module.url = "git+https://github.com/logos-blockchain/lez-indexer-module?ref=main";
};
outputs =

View File

@ -3,6 +3,7 @@
#include <algorithm>
#include <utility>
#include <QCoreApplication>
#include <QDateTime>
#include <QDir>
#include <QFile>
@ -34,7 +35,7 @@ constexpr quint64 kGapRebuildThreshold = 8;
const char* const kDefaultConfig = R"JSON({
"consensus_info_polling_interval": "1s",
"bedrock_config": {
"addr": "http://localhost:8080",
"addr": "http://localhost:18080",
"backoff": {
"start_delay": "100ms",
"max_retries": 5
@ -220,7 +221,13 @@ LezExplorerUiBackend::LezExplorerUiBackend()
setDefaultConfig(QString::fromUtf8(kDefaultConfig));
}
LezExplorerUiBackend::~LezExplorerUiBackend() = default;
LezExplorerUiBackend::~LezExplorerUiBackend()
{
// Defensive: ensure no poll fires while the backend is being torn down.
if (m_pollTimer) {
m_pollTimer->stop();
}
}
void LezExplorerUiBackend::onContextReady()
{
@ -239,6 +246,17 @@ void LezExplorerUiBackend::onContextReady()
connect(m_pollTimer, &QTimer::timeout, this, &LezExplorerUiBackend::pollTip);
m_pollTimer->start();
// pollTip() makes a synchronous cross-process call into lez_indexer_module.
// On shutdown the host SIGTERMs that dependency and only waits ~3s before
// SIGKILL, while our IPC timeout is ~20s — so a poll landing mid-teardown
// blocks on a dead peer and freezes the window. Stop polling the instant the
// app starts quitting to close that window from our side.
connect(qApp, &QCoreApplication::aboutToQuit, this, [this]() {
if (m_pollTimer) {
m_pollTimer->stop();
}
});
// Kick an immediate poll so the view fills without waiting a full interval.
pollTip();
}
@ -570,6 +588,10 @@ QString LezExplorerUiBackend::readConfigFile() const
bool LezExplorerUiBackend::startIndexerFromFile()
{
// stops the indexer if it's already running, then starts it with the config file path.
//
// this has the effect of "restarting" the indexer with the new config.
modules().lez_indexer_module.stop_indexer();
const qlonglong code = modules().lez_indexer_module.start_indexer(configFilePath());
if (code != 0) {
emit error(QStringLiteral("start_indexer failed (code %1)").arg(code));