mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-03 22:13:12 +00:00
Prevent double start issue
This commit is contained in:
parent
1edb37c8f5
commit
5a78018b75
@ -57,6 +57,7 @@ type
|
||||
repoStore: RepoStore
|
||||
maintenance: BlockMaintainer
|
||||
taskpool: Taskpool
|
||||
isStarted: bool
|
||||
|
||||
CodexPrivateKey* = libp2p.PrivateKey # alias
|
||||
EthWallet = ethers.Wallet
|
||||
@ -168,6 +169,10 @@ proc bootstrapInteractions(s: CodexServer): Future[void] {.async.} =
|
||||
s.codexNode.contracts = (client, host, validator)
|
||||
|
||||
proc start*(s: CodexServer) {.async.} =
|
||||
if s.isStarted:
|
||||
warn "Codex server already started, skipping"
|
||||
return
|
||||
|
||||
trace "Starting codex node", config = $s.config
|
||||
await s.repoStore.start()
|
||||
|
||||
@ -188,7 +193,13 @@ proc start*(s: CodexServer) {.async.} =
|
||||
if s.restServer != nil:
|
||||
s.restServer.start()
|
||||
|
||||
s.isStarted = true
|
||||
|
||||
proc stop*(s: CodexServer) {.async.} =
|
||||
if not s.isStarted:
|
||||
warn "Codex is not started"
|
||||
return
|
||||
|
||||
notice "Stopping codex node"
|
||||
|
||||
var futures =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user