diff --git a/irrd/mirroring/mirror_runners_import.py b/irrd/mirroring/mirror_runners_import.py index 1674cc3fb..7672c86f9 100644 --- a/irrd/mirroring/mirror_runners_import.py +++ b/irrd/mirroring/mirror_runners_import.py @@ -262,9 +262,12 @@ def run( database_handler=database_handler, roa_validator=roa_validator, ) - p.run_import() - if to_delete: - os.unlink(import_filename) + try: + p.run_import() + finally: + if to_delete: + os.unlink(import_filename) + if import_serial: database_handler.record_serial_newest_mirror(self.source, import_serial)