log memory usage in encrypt_file()
This commit is contained in:
parent
3ceef5bd66
commit
123f3583fd
|
@ -1,6 +1,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import gnupg
|
||||
from memory_profiler import memory_usage
|
||||
|
||||
from app.config import GNUPGHOME
|
||||
from app.log import LOG
|
||||
|
@ -24,6 +25,10 @@ def load_public_key(public_key: str) -> str:
|
|||
|
||||
|
||||
def encrypt_file(data: BytesIO, fingerprint: str) -> str:
|
||||
LOG.d("encrypt for %s", fingerprint)
|
||||
mem_usage = memory_usage(-1, interval=1, timeout=1)
|
||||
LOG.d("mem_usage %s", mem_usage)
|
||||
|
||||
r = gpg.encrypt_file(data, fingerprint, always_trust=True)
|
||||
if not r.ok:
|
||||
LOG.error("Try encrypt again %s", fingerprint)
|
||||
|
|
Loading…
Reference in a new issue