]> git.ipfire.org Git - location/libloc.git/commitdiff
importer: Ignore any duplicates in Spamhaus' feeds master
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Jun 2026 12:53:52 +0000 (12:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Jun 2026 12:53:52 +0000 (12:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/location-importer.in

index fb4dead5e126007dc8bc7c9f67ed9a95dc80f70c..aad6889725f9b50caa544d81ba89049c972c1e0d 100644 (file)
@@ -2407,7 +2407,14 @@ class CLI(object):
                                VALUES
                                (
                                        %s, %s, %s
                                VALUES
                                (
                                        %s, %s, %s
-                               )""", "%s" % network, name, True,
+                               )
+                               ON CONFLICT
+                               (
+                                       network, source
+                               )
+                               DO
+                                       NOTHING
+                               """, "%s" % network, name, True,
                        )
 
                # Raise an exception if we could not import anything
                        )
 
                # Raise an exception if we could not import anything
@@ -2460,7 +2467,14 @@ class CLI(object):
                                VALUES
                                (
                                        %s, %s, %s
                                VALUES
                                (
                                        %s, %s, %s
-                               )""", "%s" % asn, name, True,
+                               )
+                               ON CONFLICT
+                               (
+                                       number, source
+                               )
+                               DO
+                                       NOTHING
+                               """, "%s" % asn, name, True,
                        )
 
        @staticmethod
                        )
 
        @staticmethod