X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_common%2Ffsmongo.py;h=b0fe4a1ad5a69d66b1e40945db109bf8583724d9;hb=303ffe4f33c7a0fcc6b5c267d402c0e7d44e5a57;hp=727410e14a5fb21c405db4d4e97663160203a971;hpb=7da9795a4b73c72e81ac4880a9e9507e441aa90f;p=osm%2Fcommon.git diff --git a/osm_common/fsmongo.py b/osm_common/fsmongo.py index 727410e..b0fe4a1 100644 --- a/osm_common/fsmongo.py +++ b/osm_common/fsmongo.py @@ -570,7 +570,6 @@ class FsMongo(FsBase): self.__update_local_fs(from_path=from_path) def _update_mongo_fs(self, from_path): - os_path = self.path + from_path # Obtain list of files and dirs in filesystem @@ -603,7 +602,9 @@ class FsMongo(FsBase): # convert to relative path rel_filename = os.path.relpath(member["filename"], self.path) - last_modified_date = datetime.datetime.fromtimestamp( + # get timestamp in UTC because mongo stores upload date in UTC: + # https://www.mongodb.com/docs/v4.0/tutorial/model-time-data/#overview + last_modified_date = datetime.datetime.utcfromtimestamp( os.path.getmtime(member["filename"]) ) @@ -615,7 +616,6 @@ class FsMongo(FsBase): remote_files.pop(rel_filename, None) if last_modified_date >= upload_date: - stream = None fh = None try: @@ -652,7 +652,6 @@ class FsMongo(FsBase): self.fs.delete(file._id) def _get_mongo_files(self, from_path=None): - file_dict = {} file_cursor = self.fs.find(no_cursor_timeout=True, sort=[("uploadDate", -1)]) for file in file_cursor: