Skip to content

Commit

Permalink
second shot at 1089, implementing fileAgeMin and Max
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Jun 6, 2024
1 parent f2adcbb commit d028e93
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,11 +965,16 @@ def filter(self) -> None:
f"message too old (high lag): {lag:g} sec. skipping: {m['new_file']}, " )
continue

if self.o.fileAgeMax > 0 and 'mtime' in m:
if 'mtime' in m:
age = now-sarracenia.timestr2flt(m['mtime'])
if age > self.o.fileAgeMax:
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
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'],
Expand Down

0 comments on commit d028e93

Please sign in to comment.