reorder startup steps (#1642)

so the Ctr+C hook and the metrics server go before the potentially slow
`BeaconNode.init()`
This commit is contained in:
Ștefan Talpalaru 2020-09-14 08:24:31 +02:00 committed by GitHub
parent ca2e7e2239
commit 60b8905852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -1145,8 +1145,6 @@ programMain:
config.createDumpDirs()
var node = waitFor BeaconNode.init(rng, config, stateSnapshotContents)
## Ctrl+C handling
proc controlCHandler() {.noconv.} =
when defined(windows):
@ -1156,9 +1154,6 @@ programMain:
status = BeaconNodeStatus.Stopping
setControlCHook(controlCHandler)
when hasPrompt:
initPrompt(node)
when useInsecureFeatures:
if config.metricsEnabled:
let metricsAddress = config.metricsAddress
@ -1166,6 +1161,11 @@ programMain:
address = metricsAddress, port = config.metricsPort
metrics.startHttpServer($metricsAddress, config.metricsPort)
var node = waitFor BeaconNode.init(rng, config, stateSnapshotContents)
when hasPrompt:
initPrompt(node)
if node.nickname != "":
dynamicLogScope(node = node.nickname): node.start()
else: