Address review feedback
This commit is contained in:
parent
29b9295673
commit
cdcfa4572f
|
@ -61,13 +61,13 @@ func Backend(conf *logical.BackendConfig) (*backend, error) {
|
|||
salt: salt,
|
||||
|
||||
// Create the map of locks to modify the registered roles
|
||||
roleLocksMap: map[string]*sync.RWMutex{},
|
||||
roleLocksMap: make(map[string]*sync.RWMutex, 257),
|
||||
|
||||
// Create the map of locks to modify the generated RoleIDs.
|
||||
roleIDLocksMap: map[string]*sync.RWMutex{},
|
||||
roleIDLocksMap: make(map[string]*sync.RWMutex, 257),
|
||||
|
||||
// Create the map of locks to modify the generated SecretIDs.
|
||||
secretIDLocksMap: map[string]*sync.RWMutex{},
|
||||
secretIDLocksMap: make(map[string]*sync.RWMutex, 257),
|
||||
}
|
||||
|
||||
// Create 256 locks each for managing RoleID and SecretIDs. This will avoid
|
||||
|
|
|
@ -16,6 +16,10 @@ func CreateLocks(p map[string]*sync.RWMutex, count int64) error {
|
|||
return fmt.Errorf("invalid count: %d", count)
|
||||
}
|
||||
|
||||
if p == nil {
|
||||
return fmt.Errorf("map of locks is not initialized")
|
||||
}
|
||||
|
||||
for i := int64(0); i < count; i++ {
|
||||
p[fmt.Sprintf("%02x", i)] = &sync.RWMutex{}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue