From 2adc0b1a3e4a2ea460383ea7669e7f3fa20e6abf Mon Sep 17 00:00:00 2001 From: derrod Date: Wed, 29 Dec 2021 20:29:07 +0100 Subject: [PATCH] [core] Avoid unnecessary disk writes when assets didn't change --- legendary/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/legendary/core.py b/legendary/core.py index 4757cc4..3f282b4 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -335,7 +335,7 @@ class LegendaryCore: return [] if self.lgd.assets: - assets = self.lgd.assets + assets = self.lgd.assets.copy() else: assets = dict() @@ -346,7 +346,9 @@ class LegendaryCore: ] }) - self.lgd.assets = assets + # only save (and write to disk) if there were changes + if self.lgd.assets != assets: + self.lgd.assets = assets return self.lgd.assets[platform]