added monitoring skeleton

This commit is contained in:
Pedro Miranda 2024-10-19 02:44:53 +01:00
parent 53f4bbcac7
commit caec70c17f
1 changed files with 13 additions and 7 deletions

View File

@ -96,8 +96,14 @@ proc monitor*(tasksList: var NimbusTasks, config: NimbusConfig) =
info "monitoring tasks"
while true:
info "nothing new"
sleep(5000)
info "checking tasks ... "
# -check an atomic (to be created when needed) if it s required to shutdown
# this will atomic flag solves:
# - non responding thread
# - thread that required shutdown
sleep(cNimbusTaskTimeoutMs)
## create running workers
proc startTasks*(tasksList: var NimbusTasks, configs: NimbusConfig) =
@ -116,6 +122,8 @@ proc startTasks*(tasksList: var NimbusTasks, configs: NimbusConfig) =
"Consensus Layer", cNimbusTaskTimeoutMs, consensusLayerHandler, paramsConsensus
)
# ------
when isMainModule:
info "Starting Nimbus"
## TODO
@ -129,7 +137,7 @@ when isMainModule:
let nimbusConfigs = NimbusConfig()
var tasksList: NimbusTasks = NimbusTasks.new
## next code snippet requires a conf.nim file (eg: beacon_lc_bridge_conf.nim)
## this code snippet requires a conf.nim file (eg: beacon_lc_bridge_conf.nim)
# var config = makeBannerAndConfig("Nimbus client ", NimbusConfig)
# setupLogging(config.logLevel, config.logStdout, config.logFile)
@ -150,9 +158,7 @@ when isMainModule:
tasksList.joinTasks()
notice "Shutting down now"
quit(0)
setControlCHook(controlCHandler)
while true:
info "looping"
sleep(2000)
#start monitoring
tasksList.monitor(nimbusConfigs)