From: Michael Tremer Date: Tue, 4 Jul 2023 09:53:41 +0000 (+0000) Subject: geofeeds: Delete any data on 404 X-Git-Tag: 0.9.17~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf07adcce4986e38bc18ad1df567c2974c80dd38;p=location%2Flibloc.git geofeeds: Delete any data on 404 Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index 69b48cb..310e4ee 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -1404,6 +1404,11 @@ class CLI(object): self.db.execute("UPDATE geofeeds SET status = %s, error = %s \ WHERE id = %s", e.code, "%s" % e, geofeed.id) + # Remove any previous data when the feed has been deleted + if e.code == 404: + self.db.execute("DELETE FROM geofeed_networks \ + WHERE geofeed_id = %s", geofeed.id) + # Catch any other errors and connection timeouts except (urllib.request.URLError, TimeoutError) as e: log.debug("Could not fetch URL %s: %s" % (geofeed.url, e))