diff --git a/apps/networkmonitor/networkmonitor.nim b/apps/networkmonitor/networkmonitor.nim index 09a64c8d5..cb2bec6d5 100644 --- a/apps/networkmonitor/networkmonitor.nim +++ b/apps/networkmonitor/networkmonitor.nim @@ -614,6 +614,12 @@ when isMainModule: waitFor node.mountRelay() waitFor node.mountLibp2pPing() + var onFatalErrorAction = proc(msg: string) {.gcsafe, closure.} = + ## Action to be taken when an internal error occurs during the node run. + ## e.g. the connection with the database is lost and not recovered. + error "Unrecoverable error occurred", error = msg + quit(QuitFailure) + if conf.rlnRelay and conf.rlnRelayEthContractAddress != "": let rlnConf = WakuRlnConfig( rlnRelayDynamic: conf.rlnRelayDynamic, @@ -624,6 +630,7 @@ when isMainModule: rlnRelayCredPassword: "", rlnRelayTreePath: conf.rlnRelayTreePath, rlnEpochSizeSec: conf.rlnEpochSizeSec, + onFatalErrorAction: onFatalErrorAction, ) try: diff --git a/apps/networkmonitor/networkmonitor_config.nim b/apps/networkmonitor/networkmonitor_config.nim index 291144c5b..bf1662649 100644 --- a/apps/networkmonitor/networkmonitor_config.nim +++ b/apps/networkmonitor/networkmonitor_config.nim @@ -45,7 +45,9 @@ type NetworkMonitorConf* = object .}: seq[uint16] numShardsInNetwork* {. - desc: "Number of shards in the network", name: "num-shards-in-network" + desc: "Number of shards in the network", + name: "num-shards-in-network", + defaultValue: 8 .}: uint32 refreshInterval* {.