Skip to content

Commit ac9916a

Browse files
authored
lightning: Change how the ID of taskCfg.TaskID is generated (#55505)
close #55384
1 parent 4eeeef8 commit ac9916a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lightning/pkg/server/lightning.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"encoding/pem"
2828
"fmt"
2929
"io"
30+
"math/big"
3031
"net"
3132
"net/http"
3233
"net/http/pprof"
@@ -355,8 +356,12 @@ func (l *Lightning) RunOnceWithOptions(taskCtx context.Context, taskCfg *config.
355356
if err := taskCfg.Adjust(taskCtx); err != nil {
356357
return err
357358
}
359+
r, err := rand.Int(rand.Reader, big.NewInt(1<<63-1))
360+
if err != nil {
361+
return err
362+
}
363+
taskCfg.TaskID = r.Int64()
358364

359-
taskCfg.TaskID = time.Now().UnixNano()
360365
failpoint.Inject("SetTaskID", func(val failpoint.Value) {
361366
taskCfg.TaskID = int64(val.(int))
362367
})

0 commit comments

Comments
 (0)