Do not scan the log file if it is older than a day old
This commit is contained in:
parent
4a1c96574b
commit
bb713a9a21
|
|
@ -164,7 +164,9 @@ def parse_logfile(logfile_path: str, locations: List[str],
|
|||
visit_dict: VisitDict = dict(map(lambda x: (x, set()), locations))
|
||||
bot_visit_dict: VisitDict = dict(map(lambda x: (x, set()), locations))
|
||||
other_visit_dict: VisitDict = defaultdict(set)
|
||||
|
||||
if abs(os.path.getmtime(logfile_path) - datetime.now().timestamp()) >= 24 * 3600:
|
||||
print("Log file is too old, there was no access today.")
|
||||
logfile_path="/dev/null"
|
||||
with open(logfile_path, 'r', encoding='utf-8') as logfile:
|
||||
for line in logfile:
|
||||
match_obj = re.match(known_page_regex, line)
|
||||
|
|
|
|||
Loading…
Reference in New Issue