From: Michael Tremer Date: Tue, 4 Jul 2023 10:01:51 +0000 (+0000) Subject: geofeeds: Delete any data that did not update within two weeks X-Git-Tag: 0.9.17~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4e50c7afe85da56d5714280547966394688df10;p=location%2Flibloc.git geofeeds: Delete any data that did not update within two weeks Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index 310e4ee..20527f6 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -1299,6 +1299,24 @@ class CLI(object): for result in results: pass + # Delete data from any feeds that did not update in the last two weeks + with self.db.transaction(): + self.db.execute(""" + DELETE FROM + geofeed_networks + WHERE + geofeed_networks.geofeed_id IN ( + SELECT + geofeeds.id + FROM + geofeeds + WHERE + updated_at IS NULL + OR + updated_at <= CURRENT_TIMESTAMP - INTERVAL '2 weeks' + ) + """) + def _fetch_geofeed(self, geofeed): log.debug("Fetching Geofeed %s" % geofeed.url)