从一个gunicorn+gevent工作者,通过django-storages进行(分块)上传到S3,我如何确保在计算文件/分块内容的哈希时,事件循环不会被阻塞?
在source for django-storages中,似乎没有任何范围来传递md5(/another散列),并且在source for botocore中,似乎没有在计算散列时产生事件循环的范围。
发布于 2019-02-25 17:24:44
现在有了一个PR for django-storages that calculates the MD5 hash as data received by the application。
总之,这会在初始化和新部件等方面更改S3Boto3StorageFile
self._file_md5 = hashlib.md5()然后在接收到content_bytes时
self._file_md5.update(content_bytes)然后,在上传每个部件时,将ContentMD5参数传递给部件上载函数
ContentMD5=base64.b64encode(self._file_md5.digest()).decode('utf-8')https://stackoverflow.com/questions/54850449
复制相似问题