Runtime: create .md5 file at the end of all transfered files being written to disk, so that it presence indicates completeness of transfer.
--- a/runtime/PLCObject.py Tue Jun 02 11:34:50 2020 +0200
+++ b/runtime/PLCObject.py Tue Jun 02 13:37:34 2020 +0200
@@ -612,9 +612,6 @@
# Create new PLC file
self._BlobAsFile(plc_object, new_PLC_filename)
- # Store new PLC filename based on md5 key
- open(self._GetMD5FileName(), "w").write(md5sum)
-
# Then write the files
log = open(extra_files_log, "w")
for fname, blobID in extrafiles:
@@ -622,6 +619,12 @@
self._BlobAsFile(blobID, fpath)
log.write(fname+'\n')
+ # Store new PLC filename based on md5 key
+ with open(self._GetMD5FileName(), "w") as f:
+ f.write(md5sum)
+ f.flush()
+ os.fsync(f.fileno())
+
# Store new PLC filename
self.CurrentPLCFilename = NewFileName
except Exception: