Skip to content

Commit

Permalink
fix cpu miner deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
frankcrypto committed Sep 26, 2023
1 parent fd2aaff commit e3952b2
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions cmd/miner/symbols/lib/robot.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ import (
"encoding/hex"
"errors"
"fmt"
"github.com/Qitmeer/qng/cmd/miner/common"
"github.com/Qitmeer/qng/cmd/miner/core"
"github.com/Qitmeer/qng/common/hash"
"github.com/Qitmeer/qng/core/types"
"github.com/Qitmeer/qng/rpc/client"
"github.com/Qitmeer/qng/rpc/client/cmds"
"io/ioutil"
"log"
"strconv"
"strings"
"sync"
"time"

"github.com/Qitmeer/qng/cmd/miner/common"
"github.com/Qitmeer/qng/cmd/miner/core"
"github.com/Qitmeer/qng/common/hash"
"github.com/Qitmeer/qng/core/types"
"github.com/Qitmeer/qng/rpc/client"
"github.com/Qitmeer/qng/rpc/client/cmds"
)

const (
Expand Down Expand Up @@ -257,18 +258,15 @@ func (this *QitmeerRobot) SubmitWork() {
this.InvalidShares++
}
}
this.SubmitLock.Unlock()
if err != ErrLimitWork { // limit wait block connect
time.AfterFunc(1*time.Second, func() {
this.SubmitLock.Lock()
r := this.Work.Get()
this.SubmitLock.Unlock()
if this.Work.Block != nil {
common.MinerLoger.Info("Change Task", "height", this.Work.Block.Height)
}
this.NotifyWork(r)
})
}
time.AfterFunc(1*time.Second, func() {
//this.SubmitLock.Lock()
r := this.Work.Get()
this.SubmitLock.Unlock()
if this.Work.Block != nil {
common.MinerLoger.Info("Change Task", "height", this.Work.Block.Height)
}
this.NotifyWork(r)
})
} else {
if !this.Pool { // solo
this.PendingLock.Lock()
Expand Down

0 comments on commit e3952b2

Please sign in to comment.