Skip to content

Commit

Permalink
Fix the issue of using incorrect CPU cores (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode committed Apr 24, 2024
1 parent 84d107c commit f0b5b2d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
31 changes: 27 additions & 4 deletions cmd/console/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func runCmd(cmd *cobra.Command, args []string) {
minerRecord := node.NewPeerRecord()

runtime.ListenLocal()
runtime.SetCpuCores(configs.SysInit(cfg.ReadUseCpu()))
runtime.SetPID(os.Getpid())

// parse configuration file
Expand All @@ -69,6 +68,8 @@ func runCmd(cmd *cobra.Command, args []string) {
os.Exit(1)
}
}
fmt.Println("config: ", cfg.ReadUseCpu())
runtime.SetCpuCores(configs.SysInit(cfg.ReadUseCpu()))

// new chain client
cli, err := sdkgo.New(
Expand Down Expand Up @@ -147,9 +148,20 @@ func runCmd(cmd *cobra.Command, args []string) {
os.Exit(1)
}

time.Sleep(pattern.BlockInterval * 5)
time.Sleep(pattern.BlockInterval * 10)

rsakey, err = registerPoisKey(cli, peernode, teeRecord, minerPoisInfo, wspace, cfg.ReadPriorityTeeList())
for i := 0; i < 3; i++ {
rsakey, err = registerPoisKey(cli, peernode, teeRecord, minerPoisInfo, wspace, cfg.ReadPriorityTeeList())
if err != nil {
if !strings.Contains(err.Error(), "storage miner is not registered") {
out.Err(err.Error())
os.Exit(1)
}
time.Sleep(pattern.BlockInterval)
continue
}
break
}
if err != nil {
out.Err(err.Error())
os.Exit(1)
Expand Down Expand Up @@ -178,7 +190,18 @@ func runCmd(cmd *cobra.Command, args []string) {
os.Exit(1)
}
runtime.SetMinerState(string(oldRegInfo.State))
rsakey, err = registerPoisKey(cli, peernode, teeRecord, minerPoisInfo, wspace, cfg.ReadPriorityTeeList())
for i := 0; i < 3; i++ {
rsakey, err = registerPoisKey(cli, peernode, teeRecord, minerPoisInfo, wspace, cfg.ReadPriorityTeeList())
if err != nil {
if !strings.Contains(err.Error(), "storage miner is not registered") {
out.Err(err.Error())
os.Exit(1)
}
time.Sleep(pattern.BlockInterval)
continue
}
break
}
if err != nil {
out.Err(err.Error())
os.Exit(1)
Expand Down
4 changes: 2 additions & 2 deletions configs/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const (
// Name is the name of the program
Name = "bucket"
// version
Version = "v0.7.11 pre-release"
Version = "v0.7.11 devnet"
// Description is the description of the program
Description = "Storage node implementation in CESS networks"
// NameSpace is the cached namespace
NameSpaces = Name
// Chain version
ChainVersion = "0.7.6"
ChainVersion = "0.7.7"
)

var cp *x509.CertPool
Expand Down

0 comments on commit f0b5b2d

Please sign in to comment.