]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
importer: Catch TimeoutError when loading Geofeeds
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Jul 2023 09:48:44 +0000 (09:48 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Jul 2023 09:48:44 +0000 (09:48 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/location-importer.in

index bea2192ff0732d63ff36bc9c6b34b88c60a5db1d..bf83812e7f4ae43b1949b570f2b8781b37152cfb 100644 (file)
@@ -1407,6 +1407,11 @@ class CLI(object):
                        except urllib.request.URLError as e:
                                log.error("Could not fetch URL %s: %s" % (geofeed.url, e))
 
+                       # Catch connection timeouts
+                       except TimeoutError as e:
+                               self.db.execute("UPDATE geofeeds SET status = %s \
+                                       WHERE id = %s", 599, geofeed.id)
+
                        # Mark the geofeed as updated
                        else:
                                self.db.execute("""