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

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 // This means that the key is already loaded
// We need to delete and replace it // We need to delete and replace it
if cachedKey != nil { if cachedKey != nil {
cachedKey.Lock() return cachedKey, nil
defer cachedKey.Unlock()
keyId := gpgKey.GetHexKeyID()
err := s.deleteGpgKey(keyId)
if err != nil {
return nil, err
}
cachedKey.gpgId = keyId
} }
err := s.importGpgKey(armoredKey) err := s.importGpgKey(armoredKey)