Quellcode durchsuchen

[hadoop] Simplify a little copyfile

We had a series of bug about this, making the method a slightly
simpler to read.

No removing the while true as it works now.
Romain Rigaux vor 10 Jahren
Ursprung
Commit
542167a
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      desktop/libs/hadoop/src/hadoop/fs/webhdfs.py

+ 2 - 2
desktop/libs/hadoop/src/hadoop/fs/webhdfs.py

@@ -560,6 +560,7 @@ class WebHdfs(Hdfs):
     while True:
       data = self.read(src, offset, UPLOAD_CHUNK_SIZE.get())
       cnt = len(data)
+
       if offset == 0:
         if skip_header:
           n = data.index('\n')
@@ -571,8 +572,7 @@ class WebHdfs(Hdfs):
                     replication=sb.replication,
                     permission=oct(stat.S_IMODE(sb.mode)),
                     data=data)
-
-      if offset != 0:
+      else:
         self.append(dst, data)
 
       if cnt < UPLOAD_CHUNK_SIZE.get():