Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Updates the list
"""
with self.backend.db.transaction():
- # Update the timestamp
- self.updated_at = sqlmodel.func.current_timestamp()
+ updated = False
# Update all sources
for source in self.sources:
- source.update()
+ if source.update():
+ updated = True
+
+ # Update the timestamp if at least one source has actually fetched new data
+ if updated:
+ self.updated_at = sqlmodel.func.current_timestamp()
# Export!
# There is nothing to do if the source has not changed
if response.status_code == 304:
log.debug("Source %s has not been changed, skipping processing" % self)
- return
+ return False
# Add all domains
for line in response.iter_lines():
# Mark all domains that have not been updated as removed
self.__prune()
+ # Signal that we have actually fetched new data
+ return True
+
def _make_headers(self):
"""
Creates some headers we will send with the request.