Re-use instead of reloading pre-warmed key

Signed-off-by: Mustafa Gezen <mustafa@ctrliq.com>
This commit is contained in:
Mustafa Gezen 2022-08-16 12:29:49 +02:00
parent c691153e11
commit 8ef874b5ae
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
1 changed files with 1 additions and 10 deletions

View File

@ -110,16 +110,7 @@ func (s *Server) WarmGPGKey(key string, armoredKey string, gpgKey *crypto.Key, d
// This means that the key is already loaded
// We need to delete and replace it
if cachedKey != nil {
cachedKey.Lock()
defer cachedKey.Unlock()
keyId := gpgKey.GetHexKeyID()
err := s.deleteGpgKey(keyId)
if err != nil {
return nil, err
}
cachedKey.gpgId = keyId
return cachedKey, nil
}
err := s.importGpgKey(armoredKey)