Skip to content

Commit

Permalink
Skip update if the current file is less than an hour old
Browse files Browse the repository at this point in the history
  • Loading branch information
elsif2 committed Mar 18, 2024
1 parent 8fdb2f6 commit cf11cd4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions intelmq/bots/parsers/shadowserver/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ def reload():
def update_schema():
""" download the latest configuration """

# skip download if the current file is less than an hour old
if os.path.isfile(__config.schema_file):
age = time.time() - os.path.getmtime(__config.schema_file)
if age < 3600:
return False

# download the schema to a temp file
(th, tmp) = tempfile.mkstemp(dir=__config.var_state_path)
__config.logger.info("Attempting to download schema from %r", __config.schema_url)
Expand Down

0 comments on commit cf11cd4

Please sign in to comment.