Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightning: Change how the ID of taskCfg.TaskID is generated #55505

Merged
Merged
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