当前位置:网站首页>Paramiko download large file error SFTP

Paramiko download large file error SFTP

2022-05-14 13:58:30nongcunqq

resolvent
modify paramiko modular sftp_file.py file _prefetch_thread function

 def _prefetch_thread(self, chunks):
        # do these read requests in a temporary thread because there may be
        # a lot of them, so it may block.

        max_request_num = 512
        to_wait = False
        for offset, length in chunks:
            num = self.sftp._async_request(
                self, CMD_READ, self.handle, long(offset), int(length)
            )
            with self._prefetch_lock:
                self._prefetch_extents[num] = (offset, length)
                if len(self._prefetch_extents) >= max_request_num:
                    to_wait = True

            if to_wait:
                time.sleep(1)
                to_wait = False

        # for offset, length in chunks:
        # num = self.sftp._async_request(
        # self, CMD_READ, self.handle, long(offset), int(length)
        # )
        # with self._prefetch_lock:
        # self._prefetch_extents[num] = (offset, length)

Reference resources
https://blog.csdn.net/cfh0081/article/details/109782874

原网站

版权声明
本文为[nongcunqq]所创,转载请带上原文链接,感谢
https://chowdera.com/2022/134/202205141349093292.html

随机推荐