Skip to content

Commit

Permalink
lightning: Change how the ID of taskCfg.TaskID is generated (#55505)
Browse files Browse the repository at this point in the history
close #55384
  • Loading branch information
ei-sugimoto authored Aug 26, 2024
1 parent 4eeeef8 commit ac9916a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lightning/pkg/server/lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"encoding/pem"
"fmt"
"io"
"math/big"
"net"
"net/http"
"net/http/pprof"
Expand Down Expand Up @@ -355,8 +356,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 ac9916a

Please sign in to comment.