From 05f508229ce2938f3f88510080f5b65ed5a9b324 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 14 Jun 2019 20:12:33 +0100 Subject: make materials save to grid less async on manual backup or shutdown --- .../OptionalModules/Materials/MaterialsModule.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Materials') diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 822439f..2aea7f9 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -133,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Materials if(m_changed.Count == 0) return; - if(forcedBackup) + if (forcedBackup) { toStore = new List(m_changed.Keys); m_changed.Clear(); @@ -154,16 +154,29 @@ namespace OpenSim.Region.OptionalModules.Materials m_changed.Remove(fm); } } + } if(toStore.Count > 0) - Util.FireAndForget(delegate + { + if (forcedBackup) { - foreach(FaceMaterial fm in toStore) + foreach (FaceMaterial fm in toStore) { AssetBase a = MakeAsset(fm, false); m_scene.AssetService.Store(a); } - }); + } + else + { + Util.FireAndForget(delegate + { + foreach (FaceMaterial fm in toStore) + { + AssetBase a = MakeAsset(fm, false); + m_scene.AssetService.Store(a); + } + }); + } } } -- cgit v1.1