Skip to content

Commit

Permalink
Merge pull request #1264 from MetPX/issue1262_option3
Browse files Browse the repository at this point in the history
fix date check in messages.
  • Loading branch information
petersilva authored Oct 19, 2024
2 parents d4729aa + cfe476a commit 160f850
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,24 +1489,23 @@ def file_should_be_downloaded(self, msg) -> bool:
new_mtime = sarracenia.timestr2flt(msg['mtime'])
old_mtime = 0.0

if self.o.timeCopy:
old_mtime = lstat.st_mtime
elif sarracenia.filemetadata.supports_extended_attributes:
try:
x = sarracenia.filemetadata.FileMetadata(msg['new_path'])
old_mtime = sarracenia.timestr2flt(x.get('mtime'))
except:
pass
if self.o.timeCopy:
old_mtime = lstat.st_mtime
elif sarracenia.filemetadata.supports_extended_attributes:
try:
x = sarracenia.filemetadata.FileMetadata(msg['new_path'])
old_mtime = sarracenia.timestr2flt(x.get('mtime'))
except:
pass

if new_mtime <= old_mtime:
self.reject(msg, 406,
if new_mtime <= old_mtime:
self.reject(msg, 406,
"mtime not newer %s " % (msg['new_path']))
return False
else:
logger.debug(
"{} new version is {} newer (new: {} vs old: {} )".format(
msg['new_path'], new_mtime - old_mtime, new_mtime,
old_mtime))
return False
else:
logger.debug(
f"{msg['new_path']} new version is {new_mtime - old_mtime} " \
f"newer (new: {new_mtime,} vs old: {old_mtime} )" )

elif method in ['random', 'cod']:
logger.debug("content_match %s sum random/zero/cod never matches" %
Expand Down

0 comments on commit 160f850

Please sign in to comment.