Use DEFAULT_BUFFER_SIZE for md5sum

This commit is contained in:
grossmj 2023-08-03 12:09:24 +10:00
parent c51d71a4fa
commit 7ef9b7600c

View File

@ -20,7 +20,7 @@ import hashlib
from ..config import Config from ..config import Config
from . import force_unix_path from . import force_unix_path
from io import DEFAULT_BUFFER_SIZE
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -173,7 +173,7 @@ def md5sum(path, stopped_event=None):
if stopped_event is not None and stopped_event.is_set(): if stopped_event is not None and stopped_event.is_set():
log.error("MD5 sum calculation of `{}` has stopped due to cancellation".format(path)) log.error("MD5 sum calculation of `{}` has stopped due to cancellation".format(path))
return return
buf = f.read(128) buf = f.read(DEFAULT_BUFFER_SIZE)
if not buf: if not buf:
break break
m.update(buf) m.update(buf)