Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed process start function when shuffled out #2010

Merged
merged 5 commits into from
Jun 25, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 2 additions & 44 deletions cmd/node/main.go
Expand Up @@ -8,7 +8,6 @@ import (
"math"
"math/big"
"os"
"os/exec"
"os/signal"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -1346,7 +1345,7 @@ func startNode(ctx *cli.Context, log logger.Logger, version string) error {
case <-sigs:
log.Info("terminating at user's signal...")
case sig = <-chanStopNodeProcess:
log.Info("terminating at internal stop signal", "reason", sig.Reason)
log.Info("terminating at internal stop signal", "reason", sig.Reason, "description", sig.Description)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

chanCloseComponents := make(chan struct{})
Expand All @@ -1360,7 +1359,7 @@ func startNode(ctx *cli.Context, log logger.Logger, version string) error {
log.Warn("force closing the node", "error", "closeAllComponents did not finished on time")
}

handleAppClose(log, sig)
log.Debug("closing node")

return nil
}
Expand Down Expand Up @@ -1394,47 +1393,6 @@ func closeAllComponents(
chanCloseComponents <- struct{}{}
}

func handleAppClose(log logger.Logger, endProcessArgument endProcess.ArgEndProcess) {
log.Debug("closing node")

switch endProcessArgument.Reason {
case core.ShuffledOut:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave closing node final log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. also added description to the internal signal close log

log.Debug(
"restarting node",
"reason",
endProcessArgument.Reason,
"description",
endProcessArgument.Description,
)

newStartInEpoch(log)
default:
}
}

func newStartInEpoch(log logger.Logger) {
wd, err := os.Getwd()
if err != nil {
log.LogIfError(err)
}
nodeApp := os.Args[0]
args := os.Args
args = append(args, "-start-in-epoch")

log.Debug("startInEpoch", "working dir", wd, "nodeApp", nodeApp, "args", args)

cmd := exec.Command(nodeApp)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
cmd.Args = args
cmd.Dir = wd
err = cmd.Start()
if err != nil {
log.LogIfError(err)
}
}

func createStringFromRatingsData(ratingsData *rating.RatingsData) string {
metaChainStepHandler := ratingsData.MetaChainRatingsStepHandler()
shardChainHandler := ratingsData.ShardChainRatingsStepHandler()
Expand Down