~hloeung/ubuntu-repository-cache/cache-memory-tuning-fix

« back to all changes in this revision

Viewing changes to lib/ubuntu_repository_cache/metadata_sync.py

lower the buffer size for sha256 calculations, from 1G to 100M
Reviewed-on: https://code.launchpad.net/~sajoupa/ubuntu-repository-cache/layer-shrink-sha256-buffer/+merge/391817
Reviewed-by: Junien Fridrick<junien.fridrick@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
510
510
        with open(filepath, 'rb') as infile:
511
511
            sha256 = hashlib.sha256()
512
512
            while True:
513
 
                buf = infile.read(1024*1024*1024)
 
513
                buf = infile.read(1024*1024*100)
514
514
                if not buf:
515
515
                    break
516
516
                sha256.update(buf)