Closed cnlangzi closed 3 years ago
https://github.com/0chain/blobber/blob/44b88fbebc42ef3f96b3b928ee6c684dd978c3d2/code/go/0chain.net/blobbercore/allocation/workers.go#L300
connection_id is primary key in blobber's database. But NewConnectionID isn't global unique. It is a simple random number. It will make a lot of upload fail when blobber is running for long time.
func NewConnectionId() string { nBig, err := rand.Int(rand.Reader, big.NewInt(0xffffffff)) if err != nil { panic(err) } return fmt.Sprintf("%d", nBig.Int64()) }
linked to https://github.com/0chain/gosdk/issues/178
Use uuid here rather than any random number generator.
https://github.com/0chain/blobber/blob/44b88fbebc42ef3f96b3b928ee6c684dd978c3d2/code/go/0chain.net/blobbercore/allocation/workers.go#L300
connection_id is primary key in blobber's database. But NewConnectionID isn't global unique. It is a simple random number. It will make a lot of upload fail when blobber is running for long time.
func NewConnectionId() string { nBig, err := rand.Int(rand.Reader, big.NewInt(0xffffffff)) if err != nil { panic(err) } return fmt.Sprintf("%d", nBig.Int64()) }
linked to https://github.com/0chain/gosdk/issues/178