Sfoglia il codice sorgente

remove pgp retry mechanism

Son NK 5 anni fa
parent
commit
582a971b80
1 ha cambiato i file con 7 aggiunte e 10 eliminazioni
  1. 7 10
      app/pgp_utils.py

+ 7 - 10
app/pgp_utils.py

@@ -43,15 +43,12 @@ def encrypt_file(data: BytesIO, fingerprint: str) -> str:
 
     r = gpg.encrypt_file(data, fingerprint, always_trust=True)
     if not r.ok:
-        LOG.error("Try encrypt again %s", fingerprint)
-        r = gpg.encrypt_file(data, fingerprint, always_trust=True)
-        if not r.ok:
-            # save the content for debugging
-            random_file_name = random_string(20) + ".eml"
-            full_path = f"/tmp/{random_file_name}"
-            with open(full_path, "wb") as f:
-                f.write(data.getbuffer())
-            LOG.error("PGP fail - log to %s", full_path)
-            raise PGPException("Cannot encrypt")
+        # save the content for debugging
+        random_file_name = random_string(20) + ".eml"
+        full_path = f"/tmp/{random_file_name}"
+        with open(full_path, "wb") as f:
+            f.write(data.getbuffer())
+        LOG.error("PGP fail - log to %s", full_path)
+        raise PGPException("Cannot encrypt")
 
     return str(r)