Browse Source

concurrent shutdown

pull/1943/head
Ethan Buchman 9 years ago
parent
commit
8b735b36be
3 changed files with 16 additions and 2 deletions
  1. +8
    -0
      README.md
  2. +7
    -1
      handlers/handlers.go
  3. +1
    -1
      types/val.go

+ 8
- 0
README.md View File

@ -37,3 +37,11 @@ The chain's rpc can be found at http://localhost:46657.
The netmon expects a config file with a list of chains/validators to get started. A default one for a local chain is provided as local-chain.json. `netmon config` can be used to create a config file for a chain deployed with `mintnet`. The netmon expects a config file with a list of chains/validators to get started. A default one for a local chain is provided as local-chain.json. `netmon config` can be used to create a config file for a chain deployed with `mintnet`.
The API is available as GET requests with URI encoded parameters, or as JSONRPC POST requests. The JSONRPC methods are also exposed over websocket. The API is available as GET requests with URI encoded parameters, or as JSONRPC POST requests. The JSONRPC methods are also exposed over websocket.
# TODO
- log metrics for charts
- mintnet rpc commands
- chain size
- val set changes
- more efficient locking / refactor for a big select loop

+ 7
- 1
handlers/handlers.go View File

@ -49,11 +49,17 @@ func NewTendermintNetwork() *TendermintNetwork {
func (tn *TendermintNetwork) Stop() { func (tn *TendermintNetwork) Stop() {
tn.mtx.Lock() tn.mtx.Lock()
defer tn.mtx.Unlock() defer tn.mtx.Unlock()
wg := new(sync.WaitGroup)
for _, c := range tn.Chains { for _, c := range tn.Chains {
for _, v := range c.Config.Validators { for _, v := range c.Config.Validators {
v.Stop()
wg.Add(1)
go func(val *types.ValidatorState) {
val.Stop()
wg.Done()
}(v)
} }
} }
wg.Wait()
} }
//----------------------------------------------------------- //-----------------------------------------------------------


+ 1
- 1
types/val.go View File

@ -69,7 +69,7 @@ func (vs *ValidatorState) Start() error {
vs.Config.mtx.Unlock() vs.Config.mtx.Unlock()
em := eventmeter.NewEventMeter(fmt.Sprintf("ws://%s/websocket", rpcAddr), UnmarshalEvent) em := eventmeter.NewEventMeter(fmt.Sprintf("ws://%s/websocket", rpcAddr), UnmarshalEvent)
if err := em.Start(); err != nil {
if _, err := em.Start(); err != nil {
return err return err
} }
vs.em = em vs.em = em


Loading…
Cancel
Save