Skip to content

Commit

Permalink
Merge pull request #1100 from MetPX/issue1089
Browse files Browse the repository at this point in the history
Issue1089 fileAgeMin and fileAgeMax should be honoured by all components
  • Loading branch information
petersilva authored Jun 6, 2024
2 parents b0377c6 + d028e93 commit 2a28e91
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,20 @@ def filter(self) -> None:
if self.o.messageAgeMax != 0 and lag > self.o.messageAgeMax:
self.reject(
m, 504,
"Excessive lag: %g sec. Skipping download of: %s, " %
(lag, m['new_file']))
f"message too old (high lag): {lag:g} sec. skipping: {m['new_file']}, " )
continue

if 'mtime' in m:
age = now-sarracenia.timestr2flt(m['mtime'])
if self.o.fileAgeMax > 0 and age > self.o.fileAgeMax:
self.reject( m, 410, f"file too old: {age:g} sec. skipping: {m['new_file']}, ")
continue

if self.o.fileAgeMin > 0 and age < self.o.fileAgeMin:
logger.warning( f"file too young: queueing for retry.")
self.worklist.failed.append(msg)
continue

if 'fileOp' in m and 'rename' in m['fileOp']:
url = self.o.variableExpansion(m['baseUrl'],
m) + os.sep + m['fileOp']['rename']
Expand Down

0 comments on commit 2a28e91

Please sign in to comment.