readv should just yield results as it gets them (suggestion from robertc)
This commit is contained in:
parent
57bc6728af
commit
2067e9a136
|
@ -388,11 +388,9 @@ class SFTPFile (BufferedFile):
|
||||||
ordered_chunks.sort(lambda x, y: cmp(x[0], y[0]))
|
ordered_chunks.sort(lambda x, y: cmp(x[0], y[0]))
|
||||||
self._start_prefetch(ordered_chunks)
|
self._start_prefetch(ordered_chunks)
|
||||||
# now we can just devolve to a bunch of read()s :)
|
# now we can just devolve to a bunch of read()s :)
|
||||||
out = []
|
|
||||||
for x in chunks:
|
for x in chunks:
|
||||||
self.seek(x[0])
|
self.seek(x[0])
|
||||||
out.append(self.read(x[1]))
|
yield self.read(x[1])
|
||||||
return out
|
|
||||||
|
|
||||||
|
|
||||||
### internals...
|
### internals...
|
||||||
|
|
|
@ -232,7 +232,7 @@ class BigSFTPTest (unittest.TestCase):
|
||||||
for i in xrange(len(readv_list)):
|
for i in xrange(len(readv_list)):
|
||||||
offset = readv_list[i][0]
|
offset = readv_list[i][0]
|
||||||
n_offset = offset % 1024
|
n_offset = offset % 1024
|
||||||
self.assertEqual(ret[i], k2blob[n_offset:n_offset + chunk])
|
self.assertEqual(ret.next(), k2blob[n_offset:n_offset + chunk])
|
||||||
f.close()
|
f.close()
|
||||||
end = time.time()
|
end = time.time()
|
||||||
sys.stderr.write('%ds ' % round(end - start))
|
sys.stderr.write('%ds ' % round(end - start))
|
||||||
|
|
Loading…
Reference in New Issue