From 22227fa0b81e0ae6604af845bc20349a19e9aba9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 8 Feb 2020 01:10:30 +0000 Subject: [PATCH] reduce some more spam on log --- .../InventoryAccess/HGAssetMapper.cs | 2 +- .../Region/Framework/Scenes/UuidGatherer.cs | 35 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index f604dd0ec6..f1a8dce298 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // Find all the embedded assets HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty); uuidGatherer.AddForInspection(asset.FullID); - uuidGatherer.GatherAll(); + uuidGatherer.GatherAll(true); // Check which assets already exist in the destination server diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 00f3aa17cd..85a6c5de3f 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -29,8 +29,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; -using System.Text.RegularExpressions; -using System.Threading; +using System.Text; using log4net; using OpenMetaverse; using OpenMetaverse.Assets; @@ -69,6 +68,8 @@ namespace OpenSim.Region.Framework.Scenes public HashSet UncertainAssetsUUIDs { get; private set; } public int possibleNotAssetCount { get; set; } public int ErrorCount { get; private set; } + private bool verbose = true; + /// /// Gets the next UUID to inspect. /// @@ -267,20 +268,36 @@ namespace OpenSim.Region.Framework.Scenes GetAssetUuids(nextToInspect); - return m_assetUuidsToInspect.Count != 0; + return m_assetUuidsToInspect.Count > 0; } /// /// Gathers all remaining asset UUIDS no matter how many calls are required to the asset service. /// /// false if gathering is already complete, true otherwise - public bool GatherAll() + public bool GatherAll(bool report = false) { if (Complete) return false; + if(report) + verbose = false; while (GatherNext()); + if (report && FailedUUIDs.Count > 0) + { + StringBuilder sb = new StringBuilder(512); + int i = FailedUUIDs.Count; + sb.Append("[UUID GATHERER]: UUIDs that are not assets or really missing assets:\n\t"); + foreach (UUID id in FailedUUIDs) + { + sb.Append(id); + if (--i > 0) + sb.Append(','); + } + m_log.Debug(sb.ToString()); + } + return true; } @@ -321,7 +338,8 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.ErrorFormat("[UUID GATHERER]: Failed to get asset {0} : {1}", assetUuid, e.Message); + if(verbose) + m_log.ErrorFormat("[UUID GATHERER]: Failed to get asset {0} : {1}", assetUuid, e.Message); ErrorCount++; FailedUUIDs.Add(assetUuid); return; @@ -381,7 +399,8 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.ErrorFormat("[UUID GATHERER]: Failed to gather uuids for asset with id {0} type {1}: {2}", assetUuid, assetType, e.Message); + if(verbose) + m_log.ErrorFormat("[UUID GATHERER]: Failed to gather uuids for asset with id {0} type {1}: {2}", assetUuid, assetType, e.Message); GatheredUuids.Remove(assetUuid); ErrorCount++; FailedUUIDs.Add(assetUuid); @@ -683,13 +702,13 @@ namespace OpenSim.Region.Framework.Scenes : base(assetService, collector) { m_assetServerURL = assetServerURL; - if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) + if (!String.IsNullOrWhiteSpace(assetServerURL) && !m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) m_assetServerURL = m_assetServerURL + "/"; } protected override AssetBase GetAsset(UUID uuid) { - if (string.Empty == m_assetServerURL) + if (String.IsNullOrWhiteSpace(m_assetServerURL)) return base.GetAsset(uuid); else return FetchAsset(uuid);