mirror of
https://github.com/luxfi/netrunner.git
synced 2026-10-30 15:24:46 +00:00
* start adding some checks for node stop * avoid closing the notification chan * get to work health up to a good point * notification of node failure events to user he decides * use new channel in example * fix unit tests * add stopped node check on server healthy check * keep dead status of process and let used find out on that * add management of node failure on server * fix unit tests * fix e2e test * Update local/node.go Co-authored-by: Dan Laine <[email protected]> * fix after applying suggested changes * add more sync to local node process * check this causes unit test error at CI * add state to process manage struct * add process exit code to notification msg * fix stuff related to changing notification msg * fix unit test * add ctx to node Wait, network RemoveNode * fix unit test * kill all descendant of wait context failure * address PR comment * move context wait to Stop * fix unit test issue * use Await4 to avoid race conditions * improve comments * nit * rm comments regarding Ctrl+C special case and improve code for that * address PR comment * move node process to its own file * add missing file * reduce number of channels * address PR comments * address PR comments * change Alive method for Status method * address PR comments * avoid using of syscal * address PR comments * avoid syscall SIGNAL stuff * address PR comments * fix examples delay * fix log format; go mod tidy * Dan's pass; remove unexpectedStopChan (#158) * move status to its own package; nits * combine newNodeProcess and Start * update nodeProcess * remove unexpected stop chan * nit * fix test * fix local network stop context cancellation * fix node stop deadlock * make Stop return exit code rather than error * remove return value from killDescendants * nits; bump timeout * lint * add wait time to Status to be notified on common avalanchego startup failures * fix lock in Status() * fix lock code * increase first status call wait time * remove first call to status check Co-authored-by: Dan Laine <[email protected]>
27 lines
421 B
Go
27 lines
421 B
Go
package status
|
|
|
|
// The status of a node.
|
|
type Status byte
|
|
|
|
const (
|
|
// Process is running and hasn't been asked to stop.
|
|
Running Status = iota + 1
|
|
// Process has been asked to stop.
|
|
Stopping
|
|
// Process has exited.
|
|
Stopped
|
|
)
|
|
|
|
func (s Status) String() string {
|
|
switch s {
|
|
case Running:
|
|
return "running"
|
|
case Stopping:
|
|
return "stopping"
|
|
case Stopped:
|
|
return "stopped"
|
|
default:
|
|
return "invalid status"
|
|
}
|
|
}
|