Skip to content

Commit

Permalink
Use atomic.AddUint32() instead of uuid.New().Id()
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <[email protected]>
  • Loading branch information
Vladimir Popov committed Nov 24, 2020
1 parent 5583234 commit 76ac337
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/networkservice/common/serialize/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (

"github.com/edwarnicke/serialize"
"github.com/golang/protobuf/ptypes/empty"
"github.com/google/uuid"

"github.com/networkservicemesh/api/pkg/api/networkservice"

Expand All @@ -33,6 +32,7 @@ import (
type serializer struct {
executors map[string]*executor
executor serialize.Executor
state uint32
}

type executor struct {
Expand Down Expand Up @@ -62,7 +62,7 @@ func (s *serializer) requestConnection(

requestCh = exec.executor.AsyncExec(func() {
for exec.state == 0 {
exec.state = uuid.New().ID()
exec.state = atomic.AddUint32(&s.state, 1)
}
conn, err = requestConn(withExecutors(ctx,
newRequestExecutor(exec, connID),
Expand Down

0 comments on commit 76ac337

Please sign in to comment.