Skip to content

Commit

Permalink
lightning: Change how the ID of taskCfg.TaskID is generated (pingca…
Browse files Browse the repository at this point in the history
  • Loading branch information
ei-sugimoto authored and ti-chi-bot committed Sep 24, 2024
1 parent 55eefb6 commit 5ac6a69
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion br/pkg/lightning/lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"encoding/pem"
"fmt"
"io"
"math/big"
"net"
"net/http"
"net/http/pprof"
Expand Down Expand Up @@ -350,8 +351,12 @@ func (l *Lightning) RunOnceWithOptions(taskCtx context.Context, taskCfg *config.
if err := taskCfg.Adjust(taskCtx); err != nil {
return err
}
r, err := rand.Int(rand.Reader, big.NewInt(1<<63-1))
if err != nil {
return err
}
taskCfg.TaskID = r.Int64()

taskCfg.TaskID = time.Now().UnixNano()
failpoint.Inject("SetTaskID", func(val failpoint.Value) {
taskCfg.TaskID = int64(val.(int))
})
Expand Down

0 comments on commit 5ac6a69

Please sign in to comment.